I had a perfectly working project until i have updated to ios6.
when i tab on a bar item to show a popover with a view the app crashes…
here is the error i’m getting
"reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0xaa7d730; frame = (20 0; 748 1024); autoresize = RM+BM; layer = <CALayer: 0xaa7d790>> is associated with <TYOFormViewController: 0xaa7d8b0>. Clear this association before associating this view with <TYOFormViewController: 0x14c68a70>.'"
and here is the method that declares the UIViewController and the UIPopoverController.
- (IBAction)TestDriveTapped:(id)sender{
if (PopoverController != nil) {
[PopoverController dismissPopoverAnimated:YES];
self.PopoverController = nil;
}
if (self.PopoverController == nil) {
UIViewController *bookTestDrive =[[TYOFormViewController alloc] initWithNibName:@"TYOBookTestDriveForm" bundle:nil];
UIPopoverController *poc = [[UIPopoverController alloc]
initWithContentViewController:bookTestDrive];
[poc presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
self.PopoverController = poc;
} else {
if (PopoverController != nil) {
[PopoverController dismissPopoverAnimated:YES];
self.PopoverController = nil;
}
}
}
The error says i have to clear the association with TYOFormViewController to associate it with TYOFormViewController…. How did this happen???
Would love your help with this issue… jstuck all day with it..
Thanks
I also had this happening when loading a bunch of xib files. The solution was to go into interface builder and delete any view controller objects with the same class name as file’s owner. So in my case those files now contain only the view and the subviews, connected to file’s owner – no controllers.
Something must have changed under the hood in iOS 6 when interpreting xib files.