Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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?

like image 802
SMSidat Avatar asked Apr 14 '11 17:04

SMSidat


People also ask

What is info plist in iOS?

The Info. plist file contains critical information about the configuration of an iOS mobile app—such as iOS versions that are supported and device compatibility—which the operating system uses to interact with the app. This file is automatically created when the mobile app is compiled.

Where is information property list in Xcode?

To edit the contents of your information property list file, select the <project> -Info. plist file in your Xcode project to display the property list editor.


2 Answers

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.

like image 147
Wolfgang Schreurs Avatar answered Nov 04 '22 12:11

Wolfgang Schreurs


Versioned .plist files? E.g. MyApp-YYYYMMdd.plist

like image 31
alimbada Avatar answered Nov 04 '22 11:11

alimbada