为什么在应用程序中显示UIAlertView:didFinishLaunchingWithOptions:导致错误?

Jak*_*oni 2 iphone objective-c ipad ios ios5

在我的应用程序的第一次运行中,我向用户显示警报视图,以选择iCloud或本地文档存储.显示警报视图会导致以下错误:

应用程序在应用程序启动结束时应该有一个根视图控制器wait_fences:无法接收回复:10004003

为什么会这样?如何在启动时显示警报视图而不会出现此错误?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Check the user preferences for document storage options
    if (![UserPreferencesHelper userDocumentStoragePreferencesHaveBeenCreated])
    {
        // User preferences have not been set, prompt the user to choose either iCloud or Local data storage
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Use iCloud?" 
                                                        message:@"Would you like to store data in iCloud?" 
                                                       delegate:self 
                                              cancelButtonTitle:nil 
                                              otherButtonTitles:@"No", @"Yes", nil];
        [alert show];
    }
}
Run Code Online (Sandbox Code Playgroud)

**更新**

我应该提一下,我正在使用iOS 5和故事板.根视图控制器在故事板中设置.

Dar*_*ren 7

尝试替换[alert show]为:

[alert performSelector:@selector(show) withObject:nil afterDelay:0.0];
Run Code Online (Sandbox Code Playgroud)

这会延迟通过runloop的单次通过的警报,可能允许您的应用程序的控制器和故事板在警报出现之前完成其设置.