有没有办法直接查看保存到 NSUserDefaults 的内容?我想看看我的数据是否正确保存.
Is there a way to see what's been saved to NSUserDefaults directly? I'd like to see if my data saved correctly.
推荐答案你可以在模拟器中找到你的应用的 pList 文件,如果你去:
You can find the pList file for your app in the simulator if you go to:
/users/您的用户名/Library/Application Support/iPhone Simulator//Applications
/users/your user name/Library/Application Support/iPhone Simulator/<Sim Version>/Applications
这个目录有一堆GUID命名的目录.如果您正在开发一些应用程序,就会有一些应用程序.所以你需要找到你的应用程序二进制文件:
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:
find . -name foo.app ./1BAB4C83-8E7E-4671-AC36-6043F8A9BFA7/foo.app然后转到 GUID 目录中的 Library/Preferences 目录.所以:
Then go to the Library/Preferences directory in the GUID directory. So:
cd 1BAB4C83-8E7E-4671-AC35-6043F8A9BFA7/Library/Preferences您应该找到一个如下所示的文件:
You should find a file that looks like:
<Bundle Identifier>.foo.pList在 pList 编辑器中打开它并浏览持久化的值到你的内心深处.
Open this up in the pList editor and browse persisted values to your heart's content.
更多推荐
查看保存的 NSUserDefaults 的简单方法?
发布评论