iOS 4.2 中的 NSUserDefault 问题

发布于 2024-10-09 13:10:18 字数 236 浏览 0 评论 0原文

我准备了一个“Settings.bundle”文件,其中包含带有属性的 plist。但是,在编译并加载应用程序后,我在 [NSUserDefaults standardUserDefaults] 中找不到这些属性。当我进入设置并修改属性后,所有修改的属性都可以在 [NSUserDefaults standardUserDefaults] 中找到(未修改的属性仍然丢失)。这是 iOS 4.2 中的已知问题吗?我在iOS 3.2中尝试了相同的程序,没有问题。

I have prepared a "Settings.bundle" file that contains plist with properties. However, after I compile and load the app, I can't find the those properties in [NSUserDefaults standardUserDefaults]. After I go to the settings and modify the properties there, all the modified properties can be found in [NSUserDefaults standardUserDefaults] (the unmodified ones are still missing). Is this a known problem in iOS 4.2? I tried the same program in iOS 3.2 and it was ok.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

↙温凉少女 2024-10-16 13:10:18

我编写了一个库,该库复制应用程序内的setting.bundle 中的设置,在此期间我发现setting.bundle 中的默认值不会注册,除非用户转到设置应用程序中的应用程序设置。这是我编写的函数,它遍历 settings.bundle 中的所有 plist 并注册用户默认值: http://bitbucket.org/keegan3d/inappsettings/src/2053acd0524e/InAppSettings/InAppSettingsReader.m

我不确定为什么它在 iOS 3.2 中为你工作,但可能是设置是从以前的版本注册的。

I wrote a library that duplicates the settings from setting.bundle inside the app, during that I discovered that the defaults in setting.bundle are not registered unless the user goes to the app's settings in the settings app. Here's the function I wrote that goes though the all the plists in the settings.bundle and registers the user defaults: http://bitbucket.org/keegan3d/inappsettings/src/2053acd0524e/InAppSettings/InAppSettingsReader.m

I'm not sure why it's working in iOS 3.2 for you but it might be that the settings are registered from a previous build.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文