我正在調用Thread 1錯誤:程序收到信號:這裏「EXC_BAD_ACCESS」 是我的代碼EXC壞訪問iphone錯誤
[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 *路徑= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString * documentFolder = [paths objectAtIndex:0]; NSString * result = [documentFolder stringByAppendingPathComponent:@「iShotTrackGames.plist」]; 返回結果; }
謝謝,這裏是findGamesPath代碼 – 2011-04-17 21:51:42
- (NSString *)findGamesPath {NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString * documentFolder = [paths objectAtIndex:0]; NSString * result = [documentFolder stringByAppendingPathComponent:@「iShotTrackGames.plist」]; 返回結果; } – 2011-04-17 21:51:59