Skip to content

Instantly share code, notes, and snippets.

@taberh
Created August 16, 2012 02:15
Show Gist options
  • Save taberh/3365672 to your computer and use it in GitHub Desktop.
Save taberh/3365672 to your computer and use it in GitHub Desktop.
check ios app is first launch
#define LAST_LAUNCH_VERSION_KEY @"last_launch_version_of_application"
- (BOOL)isFirstLoad
{
NSString *currentVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *lastLaunchVersion = [defaults objectForKey:LAST_LAUNCH_VERSION_KEY];
if (!lastLaunchVersion || ![lastLaunchVersion isEqualToString:currentVersion]) {
[defaults setObject:currentVersion forKey:LAST_LAUNCH_VERSION_KEY];
[defaults synchronize];
return YES;
}
return NO;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment