为什么我会延迟加载 NSBundle MobileCoreServices.framework?

Why I am getting Lazy loading NSBundle MobileCoreServices.framework?

当我从主 viewController 重定向到另一个 viewController 我明白了

错误:

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...
}

更新您的应用委托中的代码。

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];
}

您收到的消息来自 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]: 这是一条系统消息。可以安全地忽略此消息。

要隐藏此类消息,请遵循 中的解决方案:

  1. 在 Product > Scheme > Edit Scheme... > 运行 下,将 OS_ACTIVITY_MODE 环境变量设置为 ${DEBUG_ACTIVITY_MODE} 所以它看起来像这样:

  1. 转到您的项目构建设置,然后单击 + 添加名为 DEBUG_ACTIVITY_MODE 的用户定义设置。展开此设置并单击调试旁边的 + 以添加特定于平台的值。 Select 下拉菜单并将其更改为 "Any iOS Simulator SDK"。然后将它的值设置为 "default",看起来像这样: