0

My iPad app supports only landscape orientation. I have presented ABNewPersonViewController (in navigationcontroller as apple docs suggestion) modally and is in land scape.

Now,

  1. when I am trying to "add Photo" the imagePicker is presented modally in PORTRAIT against my requirement.
  2. Then, immediately after adding a Photo, tapping on the image shows a popover with three buttons (- choose photo, edit photo, delete photo).

Clicking the first two buttons crashes my app with following error message:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <ABActionSheet: 0x9bbfde0; baseClass = UIActionSheet; frame = (0 0; 272 156); opaque = NO; animations = { opacity=<CABasicAnimation: 0xaa73d30>; }; layer = <CALayer: 0x9bd0370>> is associated with <_UIActionSheetHostingController: 0x9bb1000>. Clear this association before associating this view with <_UIActionSheetHostingController: 0xaa7a610>.'

Any Solutions for one and two ? Thanks & regards auk

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AUK4SO
  • 301
  • 2
  • 13
  • ABNewPersonViewController *newpersonVC=[[ABNewPersonViewController alloc]init]; newpersonVC.newPersonViewDelegate=self; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:newpersonVC]; [self presentViewController:nav animated:YES completion:Nil]; – AUK4SO Jul 18 '13 at 08:50

2 Answers2

1

The Exception clearly states that

"'A view can only be associated with at most one view controller at a time! "

You Are presenting a UIViewController with that presenting again a UIPopOverController . After clicking at index of the button trieng to present the controller , It's not possible .'

Try with dismissViewController method according to your stuff.

Kumar KL
  • 15,315
  • 9
  • 38
  • 60
0

[navController setModalPresentationStyle:UIModalPresentationFormSheet]; fixed my issue

AUK4SO
  • 301
  • 2
  • 13