开发者

iPad NSInternalInconsistencyException on UIActionSheet showInView

In my universal iPhone/iPad app, I get a crash only on the iPad when I am trying to present an action sheet within a modal view. It doesn't crash when I am in the main view. The process goes something lik开发者_JAVA百科e:

(user clicks a button to present the modal view)

-(IBAction)showModal:(id)sender {
    modalController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    [self presentModalViewController:modalController animated:YES];
}

(then, at a specified time, a function is called which then brings up a UIActionSheet)

actionSheet = [[UIActionSheet alloc] initWithTitle:@"Alarm"
                                        delegate:self
                               cancelButtonTitle:nil
                          destructiveButtonTitle:@"Dismiss"
                                   otherButtonTitles:nil];
[actionSheet showInView:self.view];

This gives me the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil'

Does anyone have any idea why I am getting this error on just the iPad? Thanks!


Shouldn't you be using?:

UIActionsheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Alarm"
                                    delegate:self
                           cancelButtonTitle:nil
                      destructiveButtonTitle:@"Dismiss"
                               otherButtonTitles:nil];

[actionSheet showInView:[self view]];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜