无法监控事件循环

无法监控事件循环

本文介绍了“无法监控事件循环"碰撞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我加了断点,发现它阻塞在

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

我也尝试了stackOverFlow中的方式,在上面的方法中加入如下代码

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

图片链接

这是didFinishLaunching方法的细节.它只是初始化一些数据并创建一个通知

Image link

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

推荐答案

虽然这不是对您问题的直接回答,但很可能是您的问题表明您做了太多工作这一非常明显的事实, 在主线程上,在 didFinishLaunchingWithOptions 中.您在此方法中的主要工作是让开,让运行时启动应用程序.你做的恰恰相反.

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.

这篇关于“无法监控事件循环"碰撞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 08:43