Maksym Bondarenko
Maksym Bondarenko

Reputation: 404

Is +[NSUserDefaults standardUserDefaults] shared across apps?

I have two questions regarding Apple's +[NSUserDefaults standardUserDefaults]:

1) Does this object represent preferences that are shared across all apps?
2) If not, and it has preferences for the current app only, what is the behavior in case I use it in a library that is embedded into two different apps? Will it be shared across these apps or not?

Upvotes: 1

Views: 412

Answers (2)

Julian F. Weinert
Julian F. Weinert

Reputation: 7560

Although mipadi is absolutely right, I'd like to add some value here.

If you explicitly want to share preferences across apps, there's "App Suites" for you.

NSUserDefaults documentation

Upvotes: 1

mipadi
mipadi

Reputation: 410612

  1. No, it is an object only used by the running application.
  2. It will return the user defaults for whatever application is linked to the library or framework, and each application will still have their own object.

Upvotes: 2

Related Questions