PDA

View Full Version : Prompt window only when application starts first time




Khanjan
Jul 28, 2009, 01:02 PM
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



kainjow
Jul 28, 2009, 01:12 PM
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:

NSString *udKey = @"RunOnce";
if (![[NSUserDefaults standardUserDefaults] objectForKey:udKey]) {
// open your window
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:udKey];
}

Khanjan
Aug 4, 2009, 10:54 AM
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:

NSString *udKey = @"RunOnce";
if (![[NSUserDefaults standardUserDefaults] objectForKey:udKey]) {
// open your window
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:udKey];
}

I tried that, it didn't quite work ! Ne other suggestions ! :(

kainjow
Aug 4, 2009, 10:57 AM
Thats fairly vague. Can you post the relevant code?