I am using the answer to this question to save an NSArray
to a file. I can't retrieve the array though. I am getting 0x00000000
for my retrieved boundaries
array when I do the following:
to save:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"boundaries"];
[array writeToFile:filePath atomically:YES];
to retrieve:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"boundaries"];
NSArray *boundaries = [NSArray arrayWithContentsOfFile:filePath];
Is something wrong with this? The array is full of correct data when I save it.
I tried saving [myArray description]
and I saved it and retrieved it okay, but the data is obviously different than what I want to have. I'm saving 8 doubles in the array.