swift 判断应用是否第一次启动

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

// NSThread .sleepForTimeInterval(5.0)

self.window=UIWindow(frame:UIScreen.mainScreen().bounds)

print(NSUserDefaults.standardUserDefaults().boolForKey(LGFirstLaunch))

// 检测用户是不是第一次启动

if !NSUserDefaults.standardUserDefaults().boolForKey(LGFirstLaunch) {

// 是第一次启动

window?.rootViewController = GuideViewController()

NSUserDefaults.standardUserDefaults().setBool(true, forKey: LGFirstLaunch)

} else {

let tabBarController = RootTabbarController()

window?.rootViewController = tabBarController

}

window?.makeKeyAndVisible()

return true

你可能感兴趣的:(swift 判断应用是否第一次启动)