0

I am new to Objective C. I want to call a pop up view on a button click. I am getting this error when I am running my application using following code

if(self.SharePopoverView==nil) {

    self.SharePopoverView = [[shareView alloc] autorelease ];
    *****************this line code creating some problem*********
    self.SharepopOverController = [[[UIPopoverController alloc] initWithContentViewController:SharePopoverView] autorelease]; 

}


[SharepopOverController presentPopoverFromBarButtonItem:self permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

I am getting the error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.'

user944329
  • 11
  • 1
  • 1

1 Answers1

3

If you are running this on iPhone it would not work as UIPopoverController is only built for iPad. But you can refer this question to get it working on iPhone.

Community
  • 1
  • 1
Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99