Re: [iPhone] Application running for the very first time...

2009-10-07 Thread Steve Christensen
On Oct 7, 2009, at 10:47 AM, Marco S Hyman wrote: On Oct 7, 2009, at 10:33 AM, Steve Christensen wrote: In that case if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PIFirstRun"] == YES){ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PIFirstRun"];

Re: [iPhone] Application running for the very first time...

2009-10-07 Thread Marco S Hyman
On Oct 7, 2009, at 10:33 AM, Steve Christensen wrote: In that case if ([[NSUserDefaults standardUserDefaults] boolForKey:@"PIFirstRun"] == YES){ [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PIFirstRun"]; //first run [user

Re: [iPhone] Application running for the very first time...

2009-10-07 Thread Steve Christensen
On Oct 1, 2009, at 10:57 PM, James Lin wrote: 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 se

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Ron Fleckner
On 02/10/2009, at 3:57 PM, James Lin wrote: 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 se

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread James Lin
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] forKe

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread James Lin
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] forKe

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Alex Kac
As I said - I wrote it into the email by memory typed code so... :) But the idea was still there. On Oct 1, 2009, at 2:17 PM, Sidney San Martín wrote: I think some of those values may be flipped: NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:10]; [dictionary

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Sidney San Martín
I think some of those values may be flipped: NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:10]; [dictionary setObject: [NSNumber numberWithBool:YES] forKey:PIFirstRun]; [[NSUserDefaults standardUserDefaults] registerDefaults:dictionary]; [dictionary release]; if

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Alex Kac
You set the default of a NSUserDefault. Set that default to FALSE. Then on startup, check the value. If its FALSE - set it to TRUE and you know its the first time. Here is some from-memory typed code: NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity: 10]; [d

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Alan Duncan
Just use a BOOL in your NSUserDefaults On Thu, Oct 1, 2009 at 11:24 AM, James Lin wrote: > Can you please elaborate on this a bit more? > > I am already using NSUserDefaults for my preferences values. > But I fail to see how this apply to determining if an Application is > launched for the

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread James Lin
Can you please elaborate on this a bit more? I am already using NSUserDefaults for my preferences values. But I fail to see how this apply to determining if an Application is launched for the very first time... What do I do? Check to see if an NSUserDefault item exists? Thanks for the help..

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Mark Woollard
No they aren't - NSUserDefaults is the approach I use for this kind of thing Sent from my iPhone On 1 Oct 2009, at 09:32, Todd Heberlein wrote: I am wondering if there is a simple way to find out when my application is running for the VERY FIRST TIME on an iPhone? So that I can set an int

Re: [iPhone] Application running for the very first time...

2009-10-01 Thread Todd Heberlein
I am wondering if there is a simple way to find out when my application is running for the VERY FIRST TIME on an iPhone? So that I can set an integer variable once only at this moment... What's the best way to do this? Also, NSUserDefaults supports this basic capability. I'm just wondering

Re: [iPhone] Application running for the very first time...

2009-09-30 Thread Todd Heberlein
I am wondering if there is a simple way to find out when my application is running for the VERY FIRST TIME on an iPhone? So that I can set an integer variable once only at this moment... What's the best way to do this? One approach is to test if a file exists on the file system, and if it d