简体   繁体   English

如何检查是否在Settings.bundle中设置了值

[英]How to check is values are set in Settings.bundle

I'd like to know if there is a way of checking whether the values set in my Settings.bundle are default values, and if they are, give a warning. 我想知道是否可以检查在我的Settings.bundle中设置的值是否为默认值,如果有,请给出警告。

Would I be correct in doing this 我这样做正确吗

‑(void)ViewDidLoad {
   if ([[NSUserDefaults standardUserDefaults] stringForKey:@"textEntry_key"] == @"" ||[[NSUserDefaults standardUserDefaults] stringForKey:@"textEntry_key2"] == @"") {
      UIAlertView *settings = [[UIAlertView alloc] initWithTitle=@"Configuration Error" message=@"Default values present in application settings. Please configure." delegate=self cancelbuttontitle = nil otherbuttontitles=@"Configure", nil];
      [settings show];
      [settings release];
   }

What I don't know to do from here is to link that button (Configure - otherbuttontitles) to the application configuration in settings.app. 从这里我不知道要做的是将该按钮(配置-其他按钮标题)链接到settings.app中的应用程序配置。

Thanks :) 谢谢 :)

I don't believe that Settings.app has a URL scheme available to launch it. 我不认为Settings.app具有可用于启动它的URL方案。 This would mean that you cannot link your "Configure" button to Settings.app. 这意味着您无法将“配置”按钮链接到Settings.app。 If you absolutely must have the user configure some settings before being able to use your app, you may want to consider providing an interface to edit the settings from within the app using NSUserDefaults. 如果绝对必须让用户配置一些设置才能使用您的应用程序,则可能需要考虑提供一个界面,以使用NSUserDefaults从应用程序内编辑设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM