我的代码是
#import "AppDelegate"
在 viewDidLoad
self.delegate = (AppDelegate *) [[UIApplication sharedApplication] delegate];
得到回复后
//If server response is success make HomeViewController as Root VC
if ([[[_response objectForKey:@"Response"] objectForKey:@"status"] isEqualToString:@"SUCCESS"]) {
dispatch_async(dispatch_get_main_queue(), ^{
//Make root view controller
UIStoryboard *mainStoryBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; //My storyboard name is Main.storyboard
HomeViewController * hvc = [mainStoryBoard instantiateViewControllerWithIdentifier:@"HVC"];
self.delegate.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:hvc];
[self.delegate.window makeKeyAndVisible];
});
}
但它不工作...