【发布时间】:2011-08-07 04:31:31
【问题描述】:
我收到一个名为线程 1 的错误:程序收到信号:“EXC_BAD_ACCESS” 这是我的代码
[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
为什么会出现错误?是否发布了太多次?
这里是 findGamesPath 代码
-(NSString *)findGamesPath { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentFolder = [paths objectAtIndex:0]; NSString *result = [documentFolder stringByAppendingPathComponent:@"iShotTrackGames.plist"]; 返回结果; }
【问题讨论】:
标签: iphone memory-management thread-safety xcode4 exc-bad-access