I’m trying to save a huge NSArray to a file and then retrieve it…
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);
The NSLog comes back with…
(null), BridgeMill
Which BridgeMill should be returned on both sides of the comma. But array won’t save…
Check if it’s being saved correctly:
On the documentation:
You can also use this to check what is going on: