How to detect first time app launch on iPhone in Xcode
Inside the "AppDelegate.m", change - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary ...
https://www.czetsuyatech.com/2014/08/xcode-detect-first-time-app-launch.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