如何将设置包中的首选项说明符之一默认为 YES?
当我在iPhone上测试时,我遇到了一个奇怪的问题...我有一个settings.bundle,其中有一个用于background_sounds的布尔值,默认情况下设置为YES。问题是,当应用程序第一次加载时,background_sounds pref 在检查时似乎设置为 NO。我尝试过同步 NSUserDefaults
和所有内容,但使其检测background_sounds 设置的唯一方法是转到应用程序的“设置”页面,不要触摸任何内容,然后返回到app...然后声音再次开始正常播放。
有什么想法吗?设置包中有错误还是只有我这样?谢谢!
编辑:如果我以正确的方式使用 NSUserDefaults ,我实际上可以让它从设置包中读取首选项。只是我必须先物理打开 iPhone 上的设置面板,然后才能在应用程序中注意到它们。没有任何意义...
I've got a weird one when I test on the iPhone... I have a settings.bundle that has a Boolean for background_sounds which is set to YES by default. The problem is, when the app loads first time, the background_sounds pref seems to be set to NO when checked. I've tried synchronizing NSUserDefaults
and everything, but the only way of making it detect the background_sounds setting, is to go to the Settings page for the app, don't touch anything and then go back to the app... Then the sounds start playing again fine.
Any ideas? Is there a bug in the settings bundle or is it just me?? Thanks!
EDIT: I can acatually get it to read the preferences from the settings bundle, if I use NSUserDefaults in the correct way. It's just that I have to physically OPEN the settings panel on the iPhone FIRST before they are noticed in the app. Makes no sense...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否正在注册您的偏好值?
Are you registering your preferences value?