Here's how to do it. You will be glad to know that it is incredibly simple. These are exactly clear lines of code.
Add this code anywhere. Perhaps just in your application: doneFinishLaunchingWithOptions: routine in the AppDelegate.m file. Or, wherever you make general settings for your application. (However, make sure it will only work once .)
NSUserDefaults *padFactoids; int launchCount; padFactoids = [NSUserDefaults standardUserDefaults]; launchCount = [padFactoids integerForKey:@"launchCount" ] + 1; [padFactoids setInteger:launchCount forKey:@"launchCount"]; [padFactoids synchronize]; NSLog(@"number of times: %i this app has been launched", launchCount); if ( launchCount == 1 ) { NSLog(@"this is the FIRST LAUNCH of the app");
Almost every application, except the simplest, does this. Hope it helps. For theory, theoretically, you don’t have to worry about a “synchronous” call, but we found a huge number of real user runs, which are probably more reliable if you enable it.
PS DO NOT use Booleans in settings. If you are a new programmer, it is best to understand the default values and therefore never support. Stick to integers. (The first time they are not used, they are always "integer zero", so you have no problem.) Easy Peasy. Hope this helps.
Fatie source share