當我看在控制檯中我得到這個消息UIActionSheet崩潰的iPad /不是iPhone
2010-09-18 17:04:05.284 Wasted Time[8998:207] *** Assertion failure in -[UIActionSheet showInView:], /SourceCache/UIKit_Sim/UIKit-1145.66/UIAlert.m:7073 2010-09-18 17:04:05.286 Wasted Time[8998:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil' 2010-09-18 17:04:05.286 Wasted Time[8998:207] Stack: ( 42272848, 43430700, 42010379, 811796, 3796273, 3862560, 9631, 3616645, 3688229, 3682846, 3690662, 3686119, 4983946, 71264534, 71263781, 71207378, 71206706, 3003734, 3030334, 3011831, 3043800, 51265916, 41552028, 41547944, 3002913, 3036018, 8314 ) terminate called after throwing an instance of 'NSException'
的代碼如下:
- (void)viewDidLoad {
BOOL continueYesNo;
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
continueYesNo = [prefs boolForKey:@"keyContinueMeeting"];
if (continueYesNo) {
NSString *message_continue = [[NSString alloc] initWithFormat:@"Do you want to Continue the Prior Meeting"];
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:message_continue
delegate:self
cancelButtonTitle:@"Reset"
destructiveButtonTitle:@"Continue"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
[actionSheet release];
[message_continue release];
}
}
運行良好無論是在iPhone和在iPhone模擬器,但在iPad模擬器中崩潰。
感謝,這使得有很大的意義,但是我沒有單獨的NIB文件的iPad版本在應用程序的先前版本中,我使用了命令 - >項目,升級當前目標的iPad。 – 2010-09-18 21:28:02
那麼,你的錯誤信息表明一個斷言是從'[UIActionSheet showInView:]'提出的,因爲'self.view'是'nil'。爲什麼它是'nil'?從那裏開始並工作。 – 2010-09-18 21:46:37
謝謝!我爲TabView控制器中的3個TabView中的每一個創建了新的XIB。允許我創建一個更好的iPad界面..你的問題讓我朝着正確的方向前進......然而,當我爲iPad版本創建新的XIB並將它們連接到mainwindow-ipad.xib(TabViewController)時,我現在得到一個新的/不同的運行時錯誤將爲此發佈一個新問題。 – 2010-09-18 23:42:36