iOS 8.2 Settings.bundle default value

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 20:34:54

The default values in your Settings bundle are not written to your app’s NSUserDefaults until the user actually goes to Settings and changes them. This has always been the case. Not sure why it was “working” for you before—maybe you never uninstalled the app from device and it kept the old settings around?

What you should do in your code, is to register default settings at startup. (Yes, this is somewhat duplicating what’s going on in your Settings bundle. That’s life.)

[[NUSUserDefaults standardDefaults] registerDefaults:
@{ @"defaultValueURL": @"http://example.com" }];

Now, this defaults key will always have the correct default value, with or without Settings bundle.

Read this post for more info.

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