Created
January 10, 2014 22:25
-
-
Save robwormald/8363896 to your computer and use it in GitHub Desktop.
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_VERSION_RUN @"Settings.LastVersionRun" | |
-(BOOL)isFirstRunForVersion | |
{ | |
// get the current version | |
NSString *currentVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; | |
// get the last version run | |
NSUserDefaults* preferences = [NSUserDefaults standardUserDefaults]; | |
NSString *lastVersion = [preferences objectForKey:LAST_VERSION_RUN]; | |
// is this a new version being run? | |
if (![currentVersion isEqual:lastVersion]) { | |
//do some stuff here | |
// yes, record this as the last version run now | |
[preferences setObject:currentVersion forKey:LAST_VERSION_RUN]; | |
[preferences synchronize]; | |
// return yes | |
return YES; | |
} else { | |
// no, return no | |
return NO; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment