查看保存的 NSUserDefaults 的简单方法? [英] Easy way to see saved NSUserDefaults?
问题描述
有没有办法直接查看保存到 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/
/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 的简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!