UIViewControllerHierarchyInconsistency在iPad方向iOS 6.1.3期间发生

时间:2014-01-23 10:01:02

标签: ipad ios6 uiviewcontroller crash orientation

我有一个几乎没有按钮的动作表。更改方向后,将重新定位此操作表。在更改方向时使用以下代码:

 [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但似乎不起作用。

1 个答案:

答案 0 :(得分:0)

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