2017-09-27 65 views
14

当我从主要的viewController重定向到另一个的viewController 我得到这个为什么我得到延迟加载NSBundle MobileCoreServices.framework?

错误:

Lazy loading NSBundle MobileCoreServices.framework,

Loaded MobileCoreServices.framework,

System group container for systemgroup.com.apple.configurationprofiles path is /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... 
} 
+0

当我评论这行它的正常工作。[self.navigationController pushViewController:lpvc动画:NO]; – iOS

+0

为什么在viewDidLoad中创建主线程? ,我认为viewDidLoad本身在主线程 –

+0

我想重定向到登录页面,当它第一次启动...你可以给我任何解决方案 – iOS

回答

19

你的消息是从Xcode的9 在Xcode 8的等效消息是:

[MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/develop/Library/Developer/CoreSimulator/Devices/083C0102-C85F-463A-96F4-CA1B9AC7919D/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

注意[MC]: 它是一个系统的消息。此消息可以安全地忽略。

要隐藏这种类型的信息,请从https://stackoverflow.com/a/42140442/1033581解决方案:

  1. 在产品>方案>编辑计划...>运行,在OS_ACTIVITY_MODE环境变量设置为$ {} DEBUG_ACTIVITY_MODE所以它看起来像这样的:

OS_ACTIVITY_MODE environment variable to ${DEBUG_ACTIVITY_MODE}

  • 转到你的项目构建设置,然后单击+添加一个名为得不一个用户定义的设置G_ACTIVITY_MODE。展开此设置并单击“调试”旁边的+以添加特定于平台的值。选择下拉菜单并将其更改为“Any iOS Simulator SDK”。然后将其值设置为“默认”,所以它看起来像这样:
  • User-Defined setting DEBUG_ACTIVITY_MODE

    +0

    你可以将他重定向到你提到的答案:https://stackoverflow.com/a/39573801/465235 –

    +3

    @ YassineElBadaoui,不,使用'disable'不是我推荐的。我建议'default'避免在Xcode 9上丢失自己的NSLog。 –

    0

    更新代码。

    if (![[NSUserDefaults standardUserDefaults] boolForKey:"HasLaunchedOnce"]){ 
         LoginPageViewController *lpvc = [self.storyboard instantiateViewControllerWithIdentifier:@"LPVC"]; 
         self.window.rootViewController = lpvc; 
         NSLog(@"Launched first time"); 
         [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"]; 
         [[NSUserDefaults standardUserDefaults] synchronize]; 
    
    }else { 
         MainViewController *mainVC = [self.storyboard instantiateViewControllerWithIdentifier:@"MainVC"]; 
         self.window.rootViewController = mainVC; 
        NSLog(@"Already launched"); 
        [self getData]; 
    } 
    
    +0

    解决方案1得到相同的问题..对于需要编写此代码的解决方案2 – iOS

    +0

    检查更新的答案 –

    +0

    我正在进入appdelegate self.storyboard找不到错误 – iOS