I'm getting this error after popping some view controllers on a navigation stack, and at the end I get to ask a question through an action sheet. I'm getting the error parameter not satisfying view != nil
, which drives me crazy because it-so facto is not a nil
value when I check before calling the action sheet.
if (self.view != nil) {
NSLog(@"view is not nil");
}
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"title" delegate:nil cancelButtonTitle:@"cancel" destructiveButtonTitle:@"destructive" otherButtonTitles:nil];
[actionSheet showInView:self.view];
Very likely that the view you are attempting to display the UIActionSheet in is not attached to the window yet. Try calling showInView after the view is attached to a window. Assuming the above code is in view controller implementation, try calling it in viewDidLoad instead of loadView.