Is there a way to see what's been saved to NSUserDefaults
directly? I'd like to see if my data saved correctly.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- Visual Studio Code, MAC OS X, OmniSharp server is
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- IntelliJ IDEA can't open projects or add SDK o
- Automator: How do I use the Choose from List actio
You can print all current NSUserDefaults to the log:
Just keys:
Keys and values:
Easy, since the plist file name is
<app-bundle-identifier>.plist
, you can usefind
command to find its path. But it will take very long if you search your whole computer, so you have to pick a good scope, like~/Library/Developer/CoreSimulator
for Xcode 6.example:
find ~/Library/Developer/CoreSimulator -type f -name com.awesome.app.plist
the output will be something like this...
/Users/hlung/Library/Developer/CoreSimulator/Devices/B61913F6-7D7C-4E45-AE2F-F45220A71823/data/Containers/Data/Application/E4CC51CF-11E5-4168-8A74-6BAE3B89998F/Library/Preferences/com.awesome.app.plist
And from there you can use
open
command. Or if you use iTerm2, just command-click on the path to open it.You could NSLog each value you set, like:
You can find the pList file for your app in the simulator if you go to:
/users/your user name/Library/Application Support/iPhone Simulator/<Sim Version>/Applications
This directory has a bunch of GUID named directories. If you are working on a few apps there will be a few of them. So you need to find your app binary:
Then go to the Library/Preferences directory in the GUID directory. So:
You should find a file that looks like:
Open this up in the pList editor and browse persisted values to your heart's content.
For Xcode 7
NSUserDefaults standardDefaults are stored here:
/Users/{USER}/Library/Developer/CoreSimulator/Devices/{UUID}/data/Containers/Data/Application/{UUID}
NSUserDefaults for a suite/app group are stored here:
/Users/{USER}/Library/Developer/CoreSimulator/Devices/{UUID}/data/Containers/Shared/AppGroup/{UUID}/Library/Preferences/{GROUP_NAME}.plist
I would recommend using https://github.com/scinfu/NCSimulatorPlugin because these days everything is behind UUIDs and are a pain to find. It allows easy access to your simulator app directories.
Swift 3