我正在尝试将一个巨大的 NSArray 保存到一个文件中,然后检索它......
NSURL *documentsDirectory =
[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject];
NSURL *fileURL = [documentsDirectory
URLByAppendingPathComponent:@"scorecards.dgs"];
NSMutableArray *savedArrayOfScorecards = [NSMutableArray arrayWithContentsOfURL:fileURL];
[savedArrayOfScorecards addObject:currentScoreCard];
[savedArrayOfScorecards writeToURL:fileURL atomically:YES];
NSMutableArray *mynewArray = [NSMutableArray arrayWithContentsOfURL:fileURL];
NSLog(@"%@, %@",[[mynewArray objectAtIndex:0] objectForKey:@"info"], course);
NSLog 回来了...
(null), BridgeMill
逗号两边应返回哪个 BridgeMill。但是数组不会保存...