I am getting an error called Thread 1: Program recieved signal:”EXC_BAD_ACCESS”
here is my code
[gameArray removeLastObject];
[gameArray addObject:shotArray];
[gamesArray removeObjectAtIndex:gameNumber];
[gamesArray insertObject:gameArray atIndex:gameNumber];
NSString *path = [self findGamesPath];
[NSKeyedArchiver archiveRootObject:gamesArray toFile:path]; // the error is here
Why is there an error? Is something being released too many times?
Here is the findGamesPath code
-(NSString *)findGamesPath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentFolder = [paths objectAtIndex:0];
NSString *result = [documentFolder stringByAppendingPathComponent:@”iShotTrackGames.plist”];
return result; }
More likely than not, something is being released too many times. Turn on zombie detection and try again.
Before you do that, though, try performing a “Build and Analyze” on your code and fix any problems it identifies.
I see this is tagged with “thread-safety”. Why? I.e. what are other threads potentially doing while the above code is running?