我 NSLog
在运行应用程序时收到消息,但nextviewcontroller
(欢迎页面)没有出现,我想在 nextviewcontroller
第一次调用时继续执行操作。只有当我们第一次运行时,此屏幕才会第一次出现。条件有效但nextviewcontroller
没有出现。我使用此代码是为了
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Configure logging framework
[DDLog addLogger:[DDTTYLogger sharedInstance]];
// Setup the XMPP stream
[self setupStream];
// Override point for customization after application launch.
BOOL launch = [[NSUserDefaults standardUserDefaults] boolForKey:@"LaunchingFirstTime"];
if(!launch){
NSLog(@"first");
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"LaunchingFirstTime"];
[[NSUserDefaults standardUserDefaults] synchronize];
self.viewController1 = [[welcomePage alloc] initWithNibName:@"welcomePage" bundle:nil];
self.window.rootViewController = self.viewController1;
}
else{
NSLog(@"second");
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
}
[self.window makeKeyAndVisible];
if (![self connect])
{
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.0 * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
//messageTableViewController
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
self.window.rootViewController = self.viewController;
//[navigationController presentModalViewController:settingsViewController animated:YES];
});
}
return YES;