应用程序无法及时启动,即使使用后台线程 [英] Application Failed to Launch in Time, even with a background thread

查看:104
本文介绍了应用程序无法及时启动,即使使用后台线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在检查applicationDidFinishLaunching中的网络可达性:

I am checking network reachability in applicationDidFinishLaunching:

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

背景线程

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

我不知道为什么我的应用程序无法及时启动? p>

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

推荐答案

[self updateInterfaceWithReachability:internetReach]; 正确更新主线程?如果没有,那可能是一个问题。

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

否则,我建议您确保您的 applicationDidFinishLaunching:正确地按照您的期望正确返回。

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).

这篇关于应用程序无法及时启动,即使使用后台线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆