在 AppDelegate.m 文件中:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
[self.window makeKeyAndVisible];
//1.取出已存的账号,判断是否过期,是否仍然正确之类
BOAccount *account = [BOAccountTool readAccount];
if (account) {
HomeViewController *homeVC = [[HomeViewController alloc] init];
self.window.rootViewController = homeVC;
}else{//2.如果不存在,登陆
LoginViewController *loginVC = [[LoginViewController alloc] init];
self.window.rootViewController = loginVC;
}
return YES;
}