#define Last_run_version_key @ "Last_run_version_of_application"
-(BOOL) isfirstload{
-
nsstring * Currentversion = [[[nsbundle mainbundle Span class= "VARs" style= "Margin:0px;padding:0px;border:none;color:rgb (221,0,0); background-color:inherit;" > infodictionary ]
Objectforkey:@ "cfbundleshortversionstring"];
Nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];
NSString *lastrunversion = [Defaults objectforkey: Last_run_version_key];
-
if (!lastRunVersion) {
-
[defaults setobject : CurrentVersion forkey :LAST_RUN_ version_key];
return YES;
}
-
else if (![ Lastrunversion isequaltostring : CurrentVersion]) {
-
[defaults setobject : CurrentVersion forkey :LAST_RUN_ version_key];
return YES;
}
return NO;
}
This article is from the "zhuoking" blog, make sure to keep this source http://9951038.blog.51cto.com/9941038/1958145
IOS determines if the app starts for the first time