Reputation: 12004
I have an app which saves its user data into a file in the documents directory like so:
NSLog(@"Saving myLibrary.dat...");
NSString *filePath = [[self documentsDirectory] stringByAppendingPathComponent:@"myLibrary.dat"];
BOOL succeed = [[NSKeyedArchiver archivedDataWithRootObject:myLibrary] writeToFile:filePath atomically:YES];
if (!succeed){
NSLog(@"There was an error saving myLibrary.dat!");
}
and my documents directory:
-(NSString*)documentsDirectory
{
NSLog(@"documentsDirectory");
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents directory
return documentsDirectory;
}
The library dat saves myLibrary which is an NSMutableArray with lots of other NSMutableArrays or NSStrings.
I have never experienced any problems with the app keeping my data save, but a user has now reported that his library gets messed up (items are being duplicated or swapped) after he does an iTunes sync.
I have not set up any syncing features with iTunes sync and have therefore no clue why he is experiencing this bug?
Can anyone think of a connection or is it simply the case that the bug must be found elsewhere (in my app) and that the user has perhaps only by chance experienced the bug right after an iTune sync?
Any thoughts would be very much appreciated!
Upvotes: 1
Views: 119