Created
August 16, 2012 02:15
-
-
Save taberh/3365672 to your computer and use it in GitHub Desktop.
check ios app is first launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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