を/分割多分私の起動作業を遅らせるために持っているか、iPhoneは、それがクラッシュした前提としています。
起動時にメインスレッドにたくさんのものを読み込まないようにしてください。あなたは多くのものをロードする必要がある場合は、このように、バックグラウンドスレッドでそれを行う:私は実際にUIActivityIndicatorでDefault.pngを示す「入口」ビューコントローラを作っ
- (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];
}
、そして上の意見の残りの部分をLAOD最終的なコールバック。 – Geri
良いアプローチのように聞こえます。 –
上記のコードに気付かなかった人のためのちょっとした注意....あなたは**メインスレッドでUIKitとやりとりする必要があります**あなたが現在バックグラウンドスレッドにいれば 'performSelectorOnMainThread: 'のようになります。 –