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]];
精彩评论