I just finished an app that allowed users to store lists of serial numbers in a tableview. The way the app stores the numbers is by storing in an NSMutableDictionary then writing to a persistence plist file. The app ran perfectly fine during testing.
However, I just built and packaged the app for ad-hoc distribution, and now when I test the app from an end-user perspective, the data is not being saved, i.e. when I add a new row to my tableview and typing in a new number, the new row is not being created and nothing is being written to the dictionary. I use the following code to write to the plist (assuming dict is already populated):
[dict writeToFile:[appDelegate dataFilePath] atomically:YES];
where in my App Delegate:
- (NSString *)dataFilePath {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingPathComponent:kFilename];
}
And I read the plist from disk using this:
NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:[appDelegate dataFilePath]];
What's wrong here?