HungCLo
HungCLo

Reputation: 472

Do iOS Apps save NSUserdefaults informations in same place?

I'm designing a soft pin App. There are two ways to save the iOS informations quickly.

  1. NSUserdefaults
  2. Keychain

All I need is just NSUserdefaults

And I read some tutorials here Tutorial Link

The NSUerdefault can save settings and properties related to application or user data. The objects will be saved in what is known as the iOS “defaults system”. The iOS defaults system is available throughout all of the code in your app, and any data saved to the defaults system will persist through application sessions.

The question is that if there are other apps use NSUserdefaults as well.

  1. Will the information conflict ?
  2. Do different Apps save NSUserdefaults informations in same place ?
  3. If I set codes to clean the NSUserdefaults informations in simulator. Can I clear all the NSUserdefaults informations, or just the App I set the codes ?

Upvotes: 0

Views: 83

Answers (1)

Dean
Dean

Reputation: 939

NSUserDefaults will save information into your apps sandboxed area. Each iOS app has it's own sandbox and data/information is only saved into the sandbox for that particular app. Different apps will save data only into there own sandboxed area so no app can access data outside it's own sandbox. This means you don't have to worry about any kind of information conflict with data from other apps. If you clean your apps NSUserDefaults information in the simulator it will just clean your apps data, not data from any other installed apps.

Upvotes: 5

Related Questions