美文网首页
webview中相机调不起来的解决方法

webview中相机调不起来的解决方法

作者: 会飞的咸鱼 | 来源:发表于2016-03-15 14:57 被阅读921次

当此webView所在控制器 是由其他控制器 modal 出来的,在webView 内部弹出actionSheet 来选择相机/相册,调起相机时会出现这样的警告:

Warning: Attempt to present on<UIImagePickerCotroller:0x150ad500>  on <ViewController2 :0x185da666>whose view is not in the window hierarchy!

并且webView所在控制器会被杀死,弹回上一个控制器,进而无法调起相机。

解决方法:

在该webView所在控制器中加入以下方法:

- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void(^)(void))completion{

if(self.presentedViewController)

{

[super dismissViewControllerAnimated:flag completion:completion];

}

}

相关文章

网友评论

      本文标题:webview中相机调不起来的解决方法

      本文链接:https://www.haomeiwen.com/subject/rgoihttx.html