Paresh Masani
Paresh Masani

Reputation: 7504

iPhone: Where NSUserDefaults get stored?

I am able to store, retrieve, and remove values using NSUserDefaults. I couldn't succeed to find out where NSUserDefaults getting stored physically on iPhone? I guess it should be plist file but not sure. Does anyone know if its possible to see this values on iPhone physically?

Thanks.

Upvotes: 16

Views: 10022

Answers (4)

Brian Redman
Brian Redman

Reputation: 448

Small differences to the accepted answer for Xcode 14.

  • Connect Your device to Xcode.
  • Select Window -> Devices and Simulators.
  • Select the Devices tab in the sidebar.
  • Select your device.
  • Select your application from the INSTALLED APPS section.
  • Click the encircled ellipsis icon and select Download Container… and Save the file.
  • In the Finder select the downloaded .xcappdata file, right click and select Show Package Contents.
  • The plist file is in the package's Appdata -> Preferencers -> Library.

Upvotes: 0

SmileBot
SmileBot

Reputation: 19642

I use SimSim. It's a free menu bar app that gives you access to all simulator folders. There are other solutions, but this is a basic tool I use all the time. https://github.com/dsmelov/simsim

Upvotes: 0

Dileep Reghu
Dileep Reghu

Reputation: 879

  • Connect Your device to Xcode.
  • Select Windows -> Organiser.
  • Select your device.
  • Click on your application.
  • Click the gear icon and Download Container….
  • Select the downloaded .xcappdata file, right click and select Show Package Contents.
  • Open the AppData folder.
  • Navigate to Library -> Preferences -> appbundlename.plist.

Upvotes: 32

Rahul Vyas
Rahul Vyas

Reputation: 28720

The physical path is rootOfApplication/Library/Preferences/com.yourcompany.appName.plist you can see there if you test it in simulator

Upvotes: 8

Related Questions