当我查看控制台时,我收到此消息
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模拟器中崩溃.
错误消息说:
无效参数不满足:view!= nil
可能来自这条线:
[actionSheet showInView:self.view];
既然你说这适用于iPhone而不是iPad,那就意味着iPad到达这条线的代码路径可能与iPhone到达这条线所需的代码路径不同.这意味着view
可能没有为iPad设置视图控制器的属性.
我的猜测:你忘了view
在Interface Builder中为这个视图控制器正在使用的xib的iPad版本连接插座.