【发布时间】:2018-03-08 11:17:37
【问题描述】:
当我从主 viewController 重定向到另一个 viewController 我收到了
错误:
懒加载NSBundle MobileCoreServices.framework,
已加载 MobileCoreServices.framework,
systemgroup.com.apple.configurationprofiles 的系统组容器 路径是 /Users/develop/Library/Developer/CoreSimulator/Devices/083C0102-C85F-463A-96F4-CA1B9AC7919D/data/Containers/Shared/SystemGroup/ systemgroup.com.apple.configurationprofiles
我的代码是...
Appdelegate.m
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSLog(@"Launched first time");
} else {
NSLog(@"Already launched");
[self getData];
}
viewDidLoad
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"]) {
dispatch_async(dispatch_get_main_queue(), ^{
LoginPageViewController *lpvc = [self.storyboard instantiateViewControllerWithIdentifier:@"LPVC"];
[self.navigationController pushViewController:lpvc animated:NO];
});
} else {
// My code...
}
【问题讨论】:
-
当我评论这一行时它工作正常..[self.navigationController pushViewController:lpvc animated:NO];
-
为什么要在 viewDidLoad 中获取主线程? ,我认为 viewDidLoad 本身在主线程上
-
我想在首次启动时重定向到登录页面...你能为我提供任何解决方案吗
-
注意:这个问题是 Xcode 9 特有的,在 Swift 中也会发生,或者没有任何导航控制器。
标签: ios objective-c uiviewcontroller appdelegate xcode9