Reputation:
and again my array of arrays ... I try to improve my app performance by buffering arrays on file for later reuse.
I have an NSMutableArray that contains about 30 NSMutableArrays with NSNumber, NSDate and NSString Objects.
I try to write the file using this call:
bool result = [myArray writeToFile:[fileMethods
getFullPath:[NSString
stringWithFormat:@"iEts%@.arr",
[aDate shortDateString]]]
atomically:NO];
=> result = FALSE.
The Path method is:
+ (NSString *) getFullPath:(NSString *)forFileName {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:forFileName];
}
and the aDate call returns a shortDateString with ddMMyy.
The NSLog
NSLog(@"%@", [fileMethods getFullPath:[NSString stringWithFormat:@"iEts%@.arr",
[aDate shortDateString]]]);
on the path generation returns:
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/86729620-EC1D-4C10-A799-0C638BB27933/Documents/iEts010510.arr
FURTHER:
Any ideas what could cause the trouble?
Upvotes: 0
Views: 383
Reputation: 86651
Have you got any NSNulls in your arrays anywhere? I don't think they count as plist objects and so would cause the write to fail.
Upvotes: 0
Reputation: 49344
AFAIK the write to file uses object archiving hence some objects in your array of arrays can't be archived.
Upvotes: 1