views:

21

answers:

1

Will this be done on every launch of the app? Since it is in the applicationDidFinishLaunching method. Is there a way to do this once and for all?

Thanks!

A: 

Hi you can take advantage of preferences..

here is the code to determine application is running for first time or not:(check this in applicationDidFinishLaunching method.)

NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
if([defaults objectForKey:@"Remote_Notification_Registered"] == nil)
{
    // This is first run ...
    // Do your only one time initialization  
    [defaults setValue:@"1" forKey:@"Remote_Notification_Registered"];
}
else
{
    // Not first run
}

Hope this will help.

Jim