Determine the version number
1. Get a status : Whether you have entered the main interface
Get to the current version
nsstring *key = (nsstring *)kcfbundleversionkey;
nsstring *version = [nsbundlemainbundle]. infodictionary [Key];
Get to Previous version
nsstring *lastversion = [[nsuserdefaultsstandarduserdefaults] valueforkey:@ "1"];
2. If you have not entered the main interface , go to the boot page
If the two version number is the same , enter the main interface, otherwise go to the boot page
if (! [Lastversion isequaltostring: Version]) {
viewcontroller *VC = [[viewcontrolleralloc]init];
[VCsetcallback: ^{
[selfstartApp];
[[nsuserdefaultsstandarduserdefaults]setValue: Versionforkey:@ "1"] ; (used a block usage, previously written)
[[nsuserdefaultsstandarduserdefaults]synchronize];
}];
Self. window. Rootviewcontroller = VC;
}
3. If you have entered the main interface, go directly to the main interface
Else
{
jump statements into the main interface
}
Determine if the user is the first time landing effect
1. Get a status, whether you have entered the main interface
BOOL b = [[[nsuserdefaultsstandarduserdefaults]Valueforkey : @ "FirstRun" ]boolvalue];
2. If you have not entered the main interface then go to the Guide page
if (!B) {
loginviewcontroller *j = [[loginviewcontrolleralloc]init ];
[Jsetcallback: ^{
[[nsuserdefaultsstandarduserdefaults]setValue:@YES forkey:@ "FirstRun"];
[[nsuserdefaultsstandarduserdefaults]synchronize];
}];
uinavigationcontroller *nav = [[uinavigationcontrolleralloc]INI Twithrootviewcontroller: j];
self. window . Rootviewcontroller = nav;
}
3. Otherwise enter the main interface
Else {
mytabbarviewcontroller *mv = [[mytabbarviewcontrolleralloc]init< /c5>];
self. window . Rootviewcontroller = mv;
}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
iOS learning (determine the version number, determine whether the user is the first time landing effect)