简体   繁体   中英

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.

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.

Thanks :)

I don't believe that Settings.app has a URL scheme available to launch it. This would mean that you cannot link your "Configure" button to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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