title: iOS Imagepicker on iPad with a SplitViewController
body: <p>I have a split view with a master table view and a detail view. On the navigation bar of my master view of my split view I have a button that should enable the user to take a picture via imagePicker. But my program keeps crashing when I hit the button. Here's the procedure of the MasterViewController.m that is called when the button is pushed:</p>
  
  <pre><code>-(void) takePicture:(id) sender
  {
  
  UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
  
  if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
  {
      [imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
  }
  else
  {
      [imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
  }
  
  [imagePicker setDelegate:self];
  
  //[self presentViewController:imagePicker animated:YES completion:nil];
  
  if( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
  {
      UIPopoverController * popOverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
      [popOverController presentPopoverFromRect:((UIButton *)sender).frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
      //[popOverController presentPopoverFromRect:CGRectMake(700, 1000, 10, 10) inView:self.detailViewController.imageSpace permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
  
  }else {
  
      [self presentViewController:imagePicker animated:YES completion:nil];
  }
  
  }
  </code></pre>
  
  <p>and here's the error message:</p>
  
  <pre><code>2013-02-11 09:06:43.975 ImageSplit2[13044:c07] -[UIBarButtonItem frame]: unrecognized selector sent to instance 0x7183d00
  2013-02-11 09:06:43.976 ImageSplit2[13044:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIBarButtonItem frame]: unrecognized selector sent to instance 0x7183d00'
  </code></pre>