开发者

how to set user defaults with folder name

I hope to set the user defaults to

~/Library/Preference 

under the folder name 'MyFolder', plist name is

com.mycompany.myapp.plist

Do I need to create the plist file and the folder by my开发者_开发问答self or the system create automatically?

Is there any tutorial?


You need to use the User Defaults System. The User Defaults classes (particularly NSUserDefaults) manage the creation and location of the preferences file and allow you to easily read and write preferences data.

By default, the User Defaults system creates a preferences file with your app's bundle ID and the plist extension under the ~/Library/Preferences folder, however you should not rely on this behaviour. If you use the API you don't need to know the location of the file as it's not important.

You should never create or manage the preferences file directly, you should always use the API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜