3

I cant find location of nsuserdefaults for my app. In same question solution was /users/your user name/Library/Application Support/iPhone Simulator//Applications. But i have no in iPhone Simulatar dir.

Community
  • 1
  • 1
ios newbie
  • 57
  • 2
  • 9

3 Answers3

8

You can do this

Search for documents directory path

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get documents folder
NSLog(@"documentsDirectory=%@",documentsDirectory);

That will come as

   /Users/user/Library/Developer/CoreSimulator/Devices/270568AE-FB4B-4C57-8819-4D99324D0689/data/Containers/Data/Application/C614A497-971F-4686-9162-3A614AB2C702/Documents 

now go upto

 /Users/user/Library/Developer/CoreSimulator/Devices/270568AE-FB4B-4C57-8819-4D99324D0689/data/Containers/Data/Application/C614A497-971F-4686-9162-3A614AB2C702

Then

/Library/Preferences/....plist

.plist file stores NSUserdefaults content under Root .

Reshmi Majumder
  • 961
  • 4
  • 15
2

When using the Simulator, you can use this swift snippet to print the location :

dump(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0])

Victor Bogdan
  • 2,022
  • 24
  • 33
0

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

and the workflow is

1.Connect Your device to Xcode

2.select Windows->Organiser

3.select you device

4.tap on your application

5.select applicationData tapping down list

6.tap down arrow and download that folder

7.open downloaded folder Library -> Preferences -> appbundlename.plist

Kumar Utsav
  • 2,761
  • 4
  • 24
  • 38