2017-09-27 103 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