Thank you for the code snipet, but I am confused at the logic here...

the following code will be executed EVERY time the program runs, right?

NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:10]; [dictionary setObject: [NSNumber numberWithBool:YES] forKey:@"PIFirstRun"];
        [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
        [dictionary release];
        
so [dictionary setObject: [NSNumber numberWithBool:YES] forKey:@"PIFirstRun"] will run EVERYTIME the program runs? Wouldn't that set my PIFirstRun to YES every time the user launch my application?

In that case....

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PIFirstRun"] == YES){ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PIFirstRun"];
                //first run
                
                [userDefaults setInteger:5 forKey:@"myIngeter"];
}

will reset my "myInteger" to 5 EVERY single time?


What if all i want is to set "myInteger" to 5 the very first time my application lunches and ONCE ONLY?

Sorry for the confusion...thanks for help again...

James


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to