iOS app update, how to update plist in the bundle?
Is there a way to update a modified plist file that's in the bundle through an iTunes app update?
I have an开发者_如何学Go app that stores some data in a plist file in the form of an array & dictionaries. On some updates I have added to the plist file with more array items, but it seems that when the app is updated, the new plist file isn't copied/updated over unless the user deletes the app and re-installs it.
How do I get the app to update the local copy of the plist file with the new one?
You can't update anything that's part of the bundle. Save the plist in the documents directory if you want to be able to update it.
NSArray *arrayPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [arrayPaths objectAtIndex:0];
Files in the documents directory don't get deleted when updating an app using the store.
Versioned .plist files? E.g. MyApp-YYYYMMdd.plist
I had a similar issue in an app. What I did to address is it check whether the app has loaded the old or the new version of the plist file when the app gets the willEnterForeground notification in the app delegate, and then load the new file from the bundle and save it to the documents directory.
精彩评论