How to direct first-time user to Settings app?

Discussion in 'iOS Programming' started by beachdog, Aug 18, 2008.

  1. beachdog macrumors member

    Joined:
    Aug 10, 2008
    #1
    So i put my application configuration information under the Settings application. Everything is working fine, but for my app to work properly I need the user to first configure some information under the settings. Is there a way I can automatically bring up the settings app for a first time user, and then automatically bring him back to my opening window after he is done? Is there a generally accepted UI approach to handling this "first time configuration" task in the iphone UI guidelines?
     
  2. Jeremy1026 macrumors 68020

    Jeremy1026

    Joined:
    Nov 3, 2007
    #2
    I'd put a simple If statement in the App did finish launching. Something like

    Code:
    if (settings == default) {
    label.text = [NSString stringWithFormat:@"Set up settings first"];
    }
    Obviously, you would have to predefine that variable somewhere (probably in a file that is written to by the settings bundle to change it to the proper value.)

    I'm sure there is an easier to way to check this, but that is the best thing I can think of right now.
     
  3. Ron C macrumors member

    Joined:
    Jul 18, 2008
    Location:
    Chicago-area
    #3
    Can you add a button to jump to Settings?

    Jeremy1026 has a good idea. Can it be improved by adding a button for the user to press to go to Settings and then update the settings for this application? I have a good idea on how to add the button, but how would you jump to the Settings application?

    Ron C
     
  4. Jeremy1026 macrumors 68020

    Jeremy1026

    Joined:
    Nov 3, 2007
    #4
    I don't think this would be possible, since it would involve your app playing outside of its sandbox by going to Settings.app, even if you are directing directly to your own settings bundle.
     
  5. Taum macrumors member

    Joined:
    Jul 28, 2008
    #5
    Well not necessarily, Apple could have done something to allow you to open the settings panel for your app. For instance, you can jump to Safari or Mail with openURL:, so they could have designed a URL scheme handled by Settings :rolleyes:
     
  6. DipDog3 macrumors 65816

    DipDog3

    Joined:
    Sep 20, 2002
    #6
    It should be possible, but I don't know if Apple implemented it. I don't remember seeing anything about a URL for Settings in the Apple Docs, and I haven't seen any other application call Settings. In theory it should be possible.
     
  7. powwowath macrumors newbie

    Joined:
    Nov 2, 2008
    #7
    Have you found a solution for that?

    I'm trying to do the same. Have you found a solution?
     
  8. DenNukem macrumors member

    DenNukem

    Joined:
    Jul 12, 2008
    Location:
    Seattle
    #8
    If you think a scenario is not covered properly, file bugs. Make sure to describe your scenario in detail, rather than "I want X".

    http://bugreport.apple.com
     
  9. TonyHoyle macrumors 6502a

    Joined:
    Sep 14, 2007
    Location:
    Manchester, UK
    #9
    You used to be able to tell Safari to go to prefs:// URLs to bring up the settings pages, but that doesn't seem to work any more. Might work from an app still - OTOH finding which URL could be a challenge.
     
  10. caveman_uk Guest

    caveman_uk

    Joined:
    Feb 17, 2003
    Location:
    Hitchin, Herts, UK
    #10
    In this situation I wouldn't bother with trying to get the settings app to run and do it all inside your app - preferably by having a decent set of default defaults (if possible) so the app will run but need tweaking or by going into a configuration screen on the first run. I think that will look cleaner than dumping the user out into the settings app then getting them to run your app again.
     
  11. powwowath macrumors newbie

    Joined:
    Nov 2, 2008
    #11
    The same behaviour as googlemaps app

    We're trying to do the same as GoogleMaps application.
    If you run the app without the GPS activated and you press the button to show your position an alert msg appears saying that the GPS is disabled, and there is a button to call the setting app!
     
  12. cpatch macrumors member

    Joined:
    Sep 17, 2007
    Location:
    San Diego, CA
    #12
    I think GoogleMaps is taking advantage of a built-in alert that comes up when attempting to use the location APIs without the GPS enabled. (Similar to what happens when you set UIRequiresPersistentWiFi in info.plist.)

    I agree with caveman_uk in that any setting that your app depends upon that can't rely on a default value should be handled within the app, not in Settings. Otherwise you're just making things unnecessarily difficult for the user and encouraging negative reviews.

    Craig
     
  13. priyank.ranka macrumors member

    Joined:
    Jun 11, 2008
    #13
    Hi EveryOne,
    My query is regarding the settings bundle. I hve hve created the settings bundle with one group which consists on a textfeild, multivalue and a boolean. When make the rootfile it appears properly into the setting apps.
    Next step was to configure ur NSUserDefault which i configured according to the root.plist but while initializing with boolean value its giving me an error also when i m tring to retrieve the value (boolean) from the root.plist its gve me the error of incompatible types.

    i show the code which i hve written fr clarification

    //code is here
    NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKey:kLastNameKey];
    //testValue = nil;
    if (testValue == nil)
    {
    // no default values have been set, create them here based on what's in our Settings bundle info

    NSString *pathStr = [[NSBundle mainBundle] bundlePath];
    NSString *settingsBundlePath = [pathStr stringByAppendingPathComponent:mad:"Settings.bundle"];
    NSString *finalPath = [settingsBundlePath stringByAppendingPathComponent:mad:"Root.plist"];

    NSDictionary *settingsDict = [NSDictionary dictionaryWithContentsOfFile:finalPath];
    NSArray *prefSpecifierArray = [settingsDict objectForKey:mad:"PreferenceSpecifiers"];

    NSString *lastNameDefault;
    NSNumber *nameColorDefault;
    Boolean *iPodSoundDefault;

    NSDictionary *prefItem;
    for (prefItem in prefSpecifierArray)
    {
    NSString *keyValueStr = [prefItem objectForKey:mad:"Key"];
    id defaultValue = [prefItem objectForKey:mad:"DefaultValue"];

    if ([keyValueStr isEqualToString:kLastNameKey])
    {
    lastNameDefault = defaultValue;
    }
    else if ([keyValueStr isEqualToString:kNameColorKey])
    {
    nameColorDefault = defaultValue;
    }
    else if ([keyValueStr isEqualToString:kPlay_sound_preference])
    {
    iPodSoundDefault = defaultValue;
    // on this statement i get the warning of incompatible value
    //but i hve put value as Boolean in the root.plist file for this key.
    }
    }

    // since no default values have been set (i.e. no preferences file created), create it here
    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
    lastNameDefault, kLastNameKey,
    [NSNumber numberWithInt:1], kNameColorKey,
    TRUE, kPlay_sound_preference,
    nil];
    //Here it gives the runtime error for the boolean value
    //Becuase whn i made other rpject without boolean value everything was
    //working properly but in this project whn i used boolean value fr toggle //switch problem started occuring

    [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
    [[NSUserDefaults standardUserDefaults] synchronize];
    }

    // we're ready to do, so lastly set the key preference values
    self.lastName = [[NSUserDefaults standardUserDefaults] stringForKey:kLastNameKey];
    self.textColor = [[NSUserDefaults standardUserDefaults] integerForKey:kNameColorKey];
    self.iPodSound = [[NSUserDefaults standardUserDefaults] boolForKey:kPlay_sound_preference]
     
  14. priyank.ranka macrumors member

    Joined:
    Jun 11, 2008
    #14
    Hi one solution can be as follows which i hve done and it works fine fr me
    write following statements
    NSString *testValue = [[NSUserDefaults standardUserDefaults] stringForKeyreference_one];
    if (testValue == nil)
    {
    NSLog(@"Setting application not yet chaged for this app");
    initialize all ur default value variables without using
    NSUserDefaults
    }
    else
    {
    // we're ready to do, so lastly set the key preference values
    self.variablename = [[NSUserDefaults standardUserDefaults] stringForKeyreference_one];
    }
     
  15. priyank.ranka macrumors member

    Joined:
    Jun 11, 2008
    #15
    Hi my query is been solved but i hve one small doubt does any1 can tell me hw can i incorporate boolean value into NSUserDefaults. Any help be appreciated
     
  16. David Orchard macrumors newbie

    Joined:
    Feb 24, 2009
    #16
    Use SetBool:forKey

    SetBool:forKey is what you want to set booleans in the standardUserDefaults. The reason is that your list is a list of objects, and a boolean isn't an object. There's special setters and getters for non-object types.

    Try [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:kPlay_sound_preference];

    Your app would become:
    // since no default values have been set (i.e. no preferences file created), create it here
    NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
    lastNameDefault, kLastNameKey,
    [NSNumber numberWithInt:1], kNameColorKey,
    nil];

    [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
    [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:kPlay_sound_preference];
    [[NSUserDefaults standardUserDefaults] synchronize];
    }

    Cheers,
    Dave
     
  17. priyank.ranka macrumors member

    Joined:
    Jun 11, 2008

Share This Page