在我的通用iPhone/iPad應用程序中,當我試圖在模態視圖中呈現操作表時,我只在iPad上發生崩潰。當我在主視圖中時它不會崩潰。處理進行類似:UIActionSheet上的iPad NSInternalInconsistencyException showInView
(用戶點擊一個按鈕來呈現模態視圖)
-(IBAction)showModal:(id)sender {
modalController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:modalController animated:YES];
}
(然後,在指定的時間,一個函數被調用,然後帶來了一個UIActionSheet)
actionSheet = [[UIActionSheet alloc] initWithTitle:@"Alarm"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
這給了我下面的錯誤:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil'
有誰有ny想法爲什麼我只是在iPad上得到這個錯誤?謝謝!
self.view爲零。您應該向我們展示更多代碼... – robertvojta 2011-02-25 22:19:53
有很多代碼我不知道包括哪些相關內容?事情是它在iPhone上運行,而不是在iPad上運行。 – user634944 2011-02-26 01:05:55
你有沒有想過這個?文檔建議在iPad上調用'showFromRect:inView:animated:'而不是'showInView:'是不可接受的。 https://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html – 2014-03-06 23:41:05