See NSUserDefaults file content

自作多情 提交于 2019-12-01 08:49:45

I'm able to open the file using "pico" but it shows weird characters.

Because as an optimization (storage space and read/write speed) iOS stores property list files in the binary format. You need to convert it to XML format using

plutil -convert xml1 com.yourapp.bundleid.plist

After this, you'll be able to see a meaningful result when opened in a text editor (such as Pico).

You can use the defaults command-line tool to easy access the UserDefaults.

defaults read <domain> <key>
defaults write <domain> <key> <value>

You can also delete keys or the whole domain (bundle id) if you need it.

You can also open the file in Xcode. Simply double-clicking on it should open it in Xcode.

As of Mac OS X 10.8, directly editing the contents of user defaults files is very likely to fail randomly. You must use either the defaults command, the NSUserDefaults API, or the CFPreferences API.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!