"Unable to monitor event loop"崩溃
"Unable to monitor event loop" crash
我添加了断点,发现它阻塞在
的方法中
- (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;
}
我也尝试了Whosebug中的方式,在上面的方法中加入如下代码
NSArray *args = [NSProcessInfo processInfo].arguments;
for(NSString *arg in args){
if ([arg isEqualToString:@"NoAnimations"]) {
[UIView setAnimationsEnabled:false];
}
}
Image link
这是didFinishLaunching方法的细节。它只是初始化一些数据并创建一个通知
虽然这不是您问题的直接答案,但您的问题很可能是一个非常明显的事实的症状,即您在 didFinishLaunchingWithOptions
中的主线程上做了太多工作.您在此方法中的主要工作是让开并让运行时启动应用程序。你做的恰恰相反。
我添加了断点,发现它阻塞在
的方法中- (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;
}
我也尝试了Whosebug中的方式,在上面的方法中加入如下代码
NSArray *args = [NSProcessInfo processInfo].arguments;
for(NSString *arg in args){
if ([arg isEqualToString:@"NoAnimations"]) {
[UIView setAnimationsEnabled:false];
}
}
Image link
这是didFinishLaunching方法的细节。它只是初始化一些数据并创建一个通知
虽然这不是您问题的直接答案,但您的问题很可能是一个非常明显的事实的症状,即您在 didFinishLaunchingWithOptions
中的主线程上做了太多工作.您在此方法中的主要工作是让开并让运行时启动应用程序。你做的恰恰相反。