Prompt window only when application starts first time

Discussion in 'Mac Programming' started by Khanjan, Jul 28, 2009.

  1. macrumors newbie

    Joined:
    Jun 25, 2009
    #1
    Hey guys,

    I have developed this interface using Objective C. Its working well. It has only one .nib file. Now, I need to add a functionality such that when the user starts this application for the first time, there is a prompt to download some databases from the internet. So, how to set up a window which would prompt only when the application starts the first time.

    Thanks a lot for all help,

    Cheers,
    Khanjan
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    I usually just look for a key in the user defaults, and if that key doesn't exist then do the once-only thing, and set a value to that key. Something like this:

    Code:
    NSString *udKey = @"RunOnce";
    if (![[NSUserDefaults standardUserDefaults] objectForKey:udKey]) {
        // open your window
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:udKey];
    }
     
  3. thread starter macrumors newbie

    Joined:
    Jun 25, 2009
    #3
    I tried that, it didn't quite work ! Ne other suggestions ! :(
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Thats fairly vague. Can you post the relevant code?
     

Share This Page