这是我的一个崩溃报告的顶部.是否有Apple确定的应用启动超时限制?任何常见的解决方法如果是的话
Elapsed total CPU time (seconds): 13.700 (user 8.580, system 5.120), 67% CPU
Elapsed application CPU time (seconds): 6.180, 30% CPU
Run Code Online (Sandbox Code Playgroud)
在iPhone 3G上.
我必须分开/延迟我的启动任务......
Nic*_*ood 10
我认为它必须在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];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3781 次 |
| 最近记录: |