Re: [iPhone] Application running for the very first time...
Re: [iPhone] Application running for the very first time...
- Subject: Re: [iPhone] Application running for the very first time...
- From: James Lin <email@hidden>
- Date: Fri, 2 Oct 2009 13:55:28 +0800
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 (email@hidden)
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:
This email sent to email@hidden