iPhone: Where NSUserDefaults get stored?

2019-01-27 15:48发布

问题:

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.

回答1:

  • 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.


回答2:

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