How to detect first time app launch on iPhone in Xcode
Inside the "AppDelegate.m", change - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary ...

http://czetsuya-tech.blogspot.com/2014/08/xcode-how-to-detect-first-time-app.html
Inside the "AppDelegate.m", change
to
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; }
to
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"]) { // app already launched } else { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"]; [[NSUserDefaults standardUserDefaults] synchronize]; // This is the first launch ever } }
Post a Comment