現在有很多應用程序第一次啓動的時候都有一個左右滑動的幫助導航,這些導航往往是介紹應用程序的新功能。
新應用在第一次啓動時或者新版本升級完第一次啓動時就顯示。
解決方法就是先檢測是不是當前版本的第一次啓動。
NSString *appFirstLaunchFlag = @"app_first_launch_flag";
NSString *cachedAppVersion = [[NSUserDefaults standardUserDefaults] objectForKey:appFirstLaunchFlag];
NSString *currentAppVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
if([currentAppVersion compare:cachedAppVersion options:NSNumericSearch] == NSOrderedDescending)
{
// First time launch
// Do some work here
[[NSUserDefaults standardUserDefaults] setObject:currentAppVersion forKey:appFirstLaunchFlag];
}
else
{}