-1

I add breakpoint and find that it block in the method that

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
// init local data
    [[PDKeychainBindings sharedKeychainBindings] setObject:@"0" forKey:kNEED_GESTURE_LOGIN];

    // register notification to notice switching RootVC
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(switchRootControllerWithType:)
                                                 name:kNoti_SwitchRootView
                                               object:nil];

    // init the third part SDK
    [self setupShareSDK];
    [self setupBugly];
    [self setupUMeng];
    [self setupIQKeyBoard];
    [self setupZhugeIOWithOptions:launchOptions];
    [self setupTrusfort];   
    // register push service
    [self setupJPushWithOptions:launchOptions];
    [self dealWithRemoteNotification:launchOptions];

    // set local flag
    [KXUserIntroManager setupFlag];

    if (self.remoteNotification) {
        if ([AccountStateManager isLogin])
            [self.loginNavigationController showGesturePDViewController];
        self.window.rootViewController = self.loginNavigationController;

    } else { 
        self.window.rootViewController = self.launchController;
    }
    return YES;
}

i also try the way in stackOverFlow ,Add the following code to the above method

    NSArray *args = [NSProcessInfo processInfo].arguments;
    for(NSString *arg in args){
        if ([arg isEqualToString:@"NoAnimations"]) {
            [UIView setAnimationsEnabled:false];
        }
    }

Image link

it is the detail of didFinishLaunching method. it just init some data and create a notification

terry
  • 13
  • 2
  • This problem is a little complicated. I can't describe it clearly. You can put forward the reasons that may cause this problem and then we can discuss it together. – terry Dec 03 '19 at 10:01
  • You need to provide more code. Telling people the system callback that it crashed in is not enough information. Post the test you have written, post the content of the didFinishLaunchingWithOptions method. Also try something like this and see if it helps: https://stackoverflow.com/questions/40156203/unable-to-monitor-event-loop-and-wait-for-app-to-idle – Simon McLoughlin Dec 03 '19 at 11:30
  • Thanks for your advice, i just use the ui-test bundle that xcode provides and run the test example without any change. it said "App event loop idle notification not received". – terry Dec 04 '19 at 03:28
  • Do not post pictures of code. – matt Dec 04 '19 at 03:47
  • sorry , i am updating right now – terry Dec 04 '19 at 03:57

1 Answers1

1

While this is not a direct answer to your question, it may well be that your issue is symptomatic of the very evident fact that you are doing much too much work, on the main thread, in didFinishLaunchingWithOptions. Your main job in this method is to get out of the way and let the runtime launch the app. You are doing the exact opposite of that.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • i got you, however when i debug the application, it can run properly. it only crashed and reported "App event loop idle notification not received"when i run the test example. i am truly stumped :( . – terry Dec 04 '19 at 05:46
  • When you debug the application, the WatchDog process is turned off and doesn't kill your app when it takes too long to launch. Maybe that's not the case for UI testing. Anyway, as I say, this is an issue that you need to deal with it, so you may as well start dealing with it. – matt Dec 04 '19 at 05:59
  • thanks a lot, i will try my best to figure it out. if you have other ideas, we can discuss here . :) – terry Dec 04 '19 at 07:31