开发者

iPhone NSKeyedArchiver - the data saved with this class persist after app update via AppStore?

开发者 https://www.devze.com 2022-12-22 06:30 出处:网络
I am a newbie in the iPhone dev and I want to know if I will save some data(NSSDictinary) with NSKeyedArchiver, tis data persist 开发者_运维技巧after an update process of my app via AppStore?

I am a newbie in the iPhone dev and I want to know if I will save some data(NSSDictinary) with NSKeyedArchiver, tis data persist 开发者_运维技巧after an update process of my app via AppStore? Let's say that I want to save user an pass for my app and probably this information will be saved into the app folder.If I will update the app via AppStore with iTunes, the old data saved are still there?The user will find his saved login credentials?

Thanks,

Alex.


Just make sure you save the data to the app's document directory (using NSKeyedArchiver archiveRootObject:toFile:).

Files Saved During Application Updates
Updating an application replaces the previous application with the new one downloaded by the user. During this process, iTunes installs the updated application in a new application directory. It then moves the user’s data files from the old installation over to the new application directory before deleting the old installation. Files in the following directories are guaranteed to be preserved during the update process:

/Documents /Library/Preferences Although files in other user directories may also be moved over, you should not rely on them being present after an update.

Getting Paths to Application Directories


You should use the NSUserDefaults to store such settings. It will write the information to a directory that will be preserved accross syncing, restoring a backup and application upgrades.

Alternatively you can use the Keychain to store the username/password. This is more secure, and it will also survive application updates or syncing / restoring a backup.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号