Reputation: 57
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.
Upvotes: 3
Views: 9174
Reputation: 14328
for here:
debugging iOS 14.3
iPhone8
for WhatsApp
, the NSUserDefaults
location for suiteName
=group.net.whatsapp.WhatsApp.shared
is:
/private/var/mobile/Containers/Shared/AppGroup/D70C70AC-D347-4640-9667-1AA86D05CB65/Library/Preferences/group.net.whatsapp.WhatsApp.shared.plist
Upvotes: 0
Reputation: 2050
When using the Simulator, you can use this swift snippet to print the location :
dump(NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0])
Upvotes: 1
Reputation: 961
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 .
Upvotes: 8
Reputation: 2841
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
Upvotes: 0