UIViewControllerHierarchyInconsistency发生在iPad的方向iOS 6.1.3

问题描述:

我有一个动作片上有几个按钮。更改方向后,此操作表重新定位。下面的代码取向期间使用改变:UIViewControllerHierarchyInconsistency发生在iPad的方向iOS 6.1.3

[self.onlineActionsheet dismissWithClickedButtonIndex:30 animated:YES]; 
[self.onlineActionsheet showInView:[(UIViewController *)self.parentViewController view]]; 

第一LOC被用于关闭ActionSheet而第二LOC被用来再次呈现它。这项工作适用于所有iOS版本。然而,在IOS 6.1.3的情况下,iPad 2的这种获取与以下日志崩溃:

*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UIActionSheet: 0x14b333b0; frame = (0 0; 272 206); opaque = NO; animations = { opacity= 
<CABasicAnimation: 0xa322d00>; }; layer = <CALayer: 0x14b2b4f0>> is associated with <_UIActionSheetHostingController: 0xa321630>. Clear this association before associating this view with <_UIActionSheetHostingController: 0xa327e20>.' 

我甚至尝试了此链接:UIViewControllerHierarchyInconsistency worked in ios5 but not in ios6但似乎这么想的工作。

确保您ViewController不包含另一个ViewController对象。例如,如果你的主视图控制器有一个tableview,不要把UITableViewController放进去。它用于在iOS 5中传递,但在iOS 6中它们不允许这样做。