Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone ABPersonViewController在选择照片时会导致UIViewControllerHierarchy在iPad上保持一致性_Iphone_Ios_Ipad - Fatal编程技术网

Iphone ABPersonViewController在选择照片时会导致UIViewControllerHierarchy在iPad上保持一致性

Iphone ABPersonViewController在选择照片时会导致UIViewControllerHierarchy在iPad上保持一致性,iphone,ios,ipad,Iphone,Ios,Ipad,我正在UINavigationController中使用ABPersonViewController来显示和编辑联系人信息。到目前为止,它一直使用最新的xcode版本(目前为4.5.2)和iOS6。如果用户选择ABPersonViewController上的编辑按钮,视图将进入编辑模式(如预期),但现在如果用户选择照片(添加或更改现有照片),则“选择照片”应用程序将崩溃,出现以下异常 **由于未捕获的异常“UIViewControllerHierarchyConsistency”而终止应用程序,

我正在UINavigationController中使用ABPersonViewController来显示和编辑联系人信息。到目前为止,它一直使用最新的xcode版本(目前为4.5.2)和iOS6。如果用户选择ABPersonViewController上的编辑按钮,视图将进入编辑模式(如预期),但现在如果用户选择照片(添加或更改现有照片),则“选择照片”应用程序将崩溃,出现以下异常

**由于未捕获的异常“UIViewControllerHierarchyConsistency”而终止应用程序,原因是:“一个视图一次最多只能与一个视图控制器关联!视图;};层=>与层关联。在将此视图与关联之前,请清除此关联。“*


这似乎是针对iPad的——我想这与iPad如何将动作表视为popover有关,除非它显示在popover中。非常感谢您的帮助。

这似乎是UIViewController新定位方法的一个问题:

- (NSUInteger)supportedInterfaceOrientations
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
看来choose photo VC没有实现它们,所以请确保您的根VC实现了它们,即使它的顶级VC没有实现

代码:

@implementation UINavigationController (Rotation_IOS6)
-(BOOL)shouldAutorotate {
    return [self.topViewController shouldAutorotate];
}
-(NSUInteger)supportedInterfaceOrientations {
    UIInterfaceOrientationMask topControllerOrientationMask = [self.topViewController supportedInterfaceOrientations];
    return topControllerOrientationMask ? topControllerOrientationMask : UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    UIInterfaceOrientation topControllerOrientation = [self.topViewController preferredInterfaceOrientationForPresentation];
    return topControllerOrientation ? topControllerOrientation : UIInterfaceOrientationPortrait;
}
@end

我也有同样的问题。尝试将ABUnknownPersonViewController推到导航控制器并以模式显示在新的导航控制器中,但这两种解决方案都存在相同的问题。我现在使用popover编辑联系人,效果很好。当我将其放在popover中时,启用文本字段时没有键盘