Iphone 应用程序特定信息:应用程序未能及时启动(iOS)?
这是我的一份坠机报告的顶部。苹果是否有任何应用程序启动超时限制?如果有,有什么共同的解决办法吗Iphone 应用程序特定信息:应用程序未能及时启动(iOS)?,iphone,ios,launch,Iphone,Ios,Launch,这是我的一份坠机报告的顶部。苹果是否有任何应用程序启动超时限制?如果有,有什么共同的解决办法吗 Elapsed total CPU time (seconds): 13.700 (user 8.580, system 5.120), 67% CPU Elapsed application CPU time (seconds): 6.180, 30% CPU 在iphone3g上 我不得不拆分/延迟我的启动任务可能…我认为它必须在5秒(或10秒)内启动,或者iPhone假定它已经崩溃 尽量避免
Elapsed total CPU time (seconds): 13.700 (user 8.580, system 5.120), 67% CPU
Elapsed application CPU time (seconds): 6.180, 30% CPU
在iphone3g上
我不得不拆分/延迟我的启动任务可能…我认为它必须在5秒(或10秒)内启动,或者iPhone假定它已经崩溃 尽量避免在启动时在主线程上加载大量内容。如果需要加载大量内容,请在后台线程上执行,如下所示:
- (void)startLoading
{
//call this in your app delegate instead of setting window.rootViewController to your main view controller
//you can show a UIActivityIndiocatorView here or something if you like
[self performSelectorInBackground:@selector(loadInBackground)];
}
- (void)loadInBackground
{
//do your loading here
//this is in the background, so don't try to access any UI elements
[self performSelectorOnMainThread:@selector(finishedLoading) withObject:nil waituntilDone:NO];
}
- (void)finishedLoading
{
//back on the main thread now, it's safe to show your view controller
window.rootViewController = viewController;
[window makeKeyAndVisible];
}
实际上,我制作了一个“入口”视图控制器,显示带有UIActivityIndicator的Default.png,然后在最后的回调中加载其余的视图。只是给上面代码中没有注意到的人一个提示。。。。您必须在主线程上与UIKit交互,因此,如果您当前处于后台线程中,则需要执行
performSelectorOnMainThread:
,如上所示。