问题
I have saved a bunch of NSUserDefaults in my app and now I am trying to find out where in the world is the plist file for for my app in Xcode 6. Here is the path for my apps document dir.
/Users/xxx/Library/Developer/CoreSimulator/Devices/676A8C61-67E4-43E0-A051-DA8BD84A84F5/data/Containers/Data/Application/B2E3C89C-48B7-4429-BBE3-FB830CD040F2/Documents
I have searched everywhere in the folder but I couldn't find where the plist file is? Is it located somewhere else? I need to manually edit a NSUserDefaults in it.
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"firstTimeLaunch1257"];
[[NSUserDefaults standardUserDefaults] synchronize];
回答1:
The NSUserDefaults plist file is in the CoreSimulator/Devices/<device id>/data/Library/Preferences folder.
This folder contains the NSUserDefaults files for all apps installed in that simulator.
The name of the plist file will match your app's bundle id.
回答2:
Update in 27 Jul 2017
xcode8.3.1 iOS8.0 macos Sierra 10.12.5
The path could be the following in simulator for developer,
/Users/
<UserName>/Library/Developer/CoreSimulator/Devices/<DeviceID>/data/Containers/Data/Application/<ApplicationID>/Library/Preferences/<YourApp>.plist
The path mentioned in the selected answer is for Apple Plist.
/Users/
<UserName>/Library/Developer/CoreSimulator/Devices/<DeviceId>/data/Library/Preferences In the path, the files arecom.apple.<AppleStuff>.plist
来源:https://stackoverflow.com/questions/26065694/where-is-plist-file-storing-nsuserdefaults-in-xcode-6