为什么这个简单的设置包没有读取任何内容?
我有一个包含以下设置的设置包。当我构建/安装我的应用程序时,Settings.app 似乎工作正常。我看到了默认值和所有内容。但在我的应用程序中,当尝试读取文本字段的文本时,我得到了零。
这是我读取设置的方式
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *temp = [defaults stringForKey:@"url_preference"];
I have a settings bundle with the following settings. When I build/install my app the Settings.app appears to work correctly. I see the default value and everything. But in my app when trying to read the text field's text I get nil.
Here is how I read the settings
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *temp = [defaults stringForKey:@"url_preference"];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设置包中的默认设置只能由“设置”应用程序读取。请参阅此问题了解详细信息和解决方法。
The defaults in the settings bundle are only read by the Settings app. See this question for details and workarounds.