Application Failed to Launch in Time, even with a background thread

强颜欢笑 提交于 2019-12-12 01:44:02

问题


I am checking network reachability in applicationDidFinishLaunching:

[self performSelectorInBackground:@selector(performReachabilityCheck) withObject:nil];

Background thread

-(void)performReachabilityCheck{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
        internetReach = [[Reachability reachabilityForInternetConnection] retain];
        [internetReach startNotifer];
        [self updateInterfaceWithReachability: internetReach];
    [pool release]; pool = nil;
}

I'm not sure why my app fails to launch in time?


回答1:


Is [self updateInterfaceWithReachability: internetReach]; correctly updating the UI in the main thread? If not, that could be a problem.

Otherwise, I would suggest you make sure that your applicationDidFinishLaunching: is correctly returning quickly as you expect.

Another thing to try is to break into the debugger as the app is firing up but before it has failed to launch. Check the backtrace and make sure the main event loop is in a sensible state (as it sounds like it isn't).



来源:https://stackoverflow.com/questions/3979065/application-failed-to-launch-in-time-even-with-a-background-thread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!