Dauntless
Dauntless

Reputation: 298

Where is NSUserDefaults saved during development?

I'm using NSUserDefaults to save some data in my application. Where can I find the file where my data is stored during development? It's a normal cocoa app (so no ios/iphone!)

Once it's deployed, it should be available in Library/Preferences/appname.plist, right? But where can I find it while I'm still working on the application?

Upvotes: 3

Views: 4184

Answers (1)

Kurt Revis
Kurt Revis

Reputation: 27984

There is no difference between "development" and "deployment". NSUserDefaults doesn't know whether you did a debug or release build. The location should be ~/Library/Preferences/yourAppIdentifier.plist no matter what.

If you are seeing a difference between development and deployment builds, maybe check the bundle identifier (CFBundleIdentifier) in your app's Info.plist.

Also: if your app is sandboxed, your prefs will end up in the sandbox: ~/Library/Containers/yourAppIdentifier/Data/Library/Preferences/yourAppIdentifier.plist. The documentation claims that the system automatically moves your old preferences file into the sandbox, if necessary, on the first launch of the sandboxed version of the app.

Upvotes: 6

Related Questions