在我的應用程序的第一次運行中,我向用戶顯示警報視圖以選擇iCloud或本地文檔存儲。顯示警報視圖導致以下錯誤:爲什麼在應用程序中顯示UIAlertView:didFinishLaunchingWithOptions:導致錯誤?
Applications are expected to have a root view controller at the end of application launch wait_fences: failed to receive reply: 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];
}
}
**更新**
我要指出,我使用的是iOS 5的故事板。根視圖控制器在故事板中設置。
Darren,謝謝!這很有效=)。我在這個牆上撞了一會兒頭...... – 2012-01-27 23:00:07