Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 309
AlienMonkeyCoder Avatar asked Jul 12 '11 10:07

AlienMonkeyCoder


People also ask

Where are the NSUserDefaults values stored?

All the contents saved by NSUserDefaults is saved inside a plist file that can be found under Library -> Preferences -> $AppBundleId.

Where are UserDefaults stored?

Storing Data in User Defaults The user's defaults database is stored on disk as a property list or plist. A property list or plist is an XML file. At runtime, the UserDefaults class keeps the contents of the property list in memory to improve performance.

What is NSUserDefaults in IOS?

NSUserDefaults caches the information to avoid having to open the user's defaults database each time you need a default value. When you set a default value, it's changed synchronously within your process, and asynchronously to persistent storage and other processes. Important.

What types can you store natively in NSUserDefaults?

Types stored in NSUserDefaultsAny . plist type can be stored by NSUserDefaults . These types are NSString(String) , NSArray(Array) , NSDictionary(Dictionary) (for both NSArray and NSDictionary types their contents must be property list objects), NSNumber(Int, Float, Double, Boolean) , NSDate and NSData .


2 Answers

  • 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.
like image 97
Dileep Reghu Avatar answered Nov 13 '22 16:11

Dileep Reghu


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

like image 25
Rahul Vyas Avatar answered Nov 13 '22 14:11

Rahul Vyas