ストーリー ボードとナビゲーション コントローラーを備えたアプリがあり、ユーザーが初めてアプリを起動したときに同意ビューをポップアップ表示したいのですが、
Appdelegate.m で
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
//app launched first time
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
[prefs setBool:YES forKey:@"firstTime"];
BOOL firstTime = [prefs boolForKey:@"firstTime"];
NSLog(@"firstTime %c",firstTime);
//check if user has agreed agreement or not
if ( firstTime==YES) {
//replace and push rootview manually
UIStoryboard *storyboard = [UIApplication sharedApplication].delegate.window.rootViewController.storyboard;
UIViewController *loginController = [storyboard instantiateViewControllerWithIdentifier:@"AgreementViewController"];
[self.window.rootViewController presentModalViewController:loginController animated:YES];
return NO;
}else
return YES;
}
Nslog
初めて を取得しましたが、reverse question mark sign
はいにもいいえにも設定されていないと思います
では、ブール値を設定して iOS デバイスに保存し、アプリが起動するたびに呼び出すにはどうすればよいでしょうか。