iOS8截图尚未呈现的视图会导致空快照 [英] iOS8 Snapshotting a view that has not been rendered results in an empty snapshot
问题描述
所以我知道这已经回答了很多次,但我还没有遇到一个解决方案,为我工作。
奇怪的是,我第一次从UIPickerController呈现相机时,它的工作正常,完全符合预期。但是,如果我再次打开它,它显示一个黑色屏幕的相机控件(取消按钮和白色拍照按钮)。
任何帮助抑制这个错误非常感谢,甚至只是一些确认这是一个错误,我只是等待苹果解决它将是一个很大的帮助!
感谢所有:)
(PS我使用iOS 8.1在iPhone 6 Plus上运行)
使用Xamarin和c#)
public void ShowPhotoTaker(UIViewController vc)
{
UIImagePickerController picker = new UIImagePickerController();
picker.SourceType = UIImagePickerControllerSourceType.Camera;
picker.FinishedPickingMedia + =(object sender,
picker.DismissViewController(true,null);
};
picker.Canceled + = object sender,EventArgs e)=> {
picker.DismissViewController(true,null);
};
vc.PresentViewController(picker,true,null);
}
这是调用此方法时获得的确切错误
快照未被渲染的视图会导致空的快照确保您的视图在屏幕更新之前在快照或快照之前至少已渲染一次。
ve联系Xamarin支持,他们告诉我,这是一个错误与iOS 8和更高版本。没有解决方案,除了等待一些bugfix推出iOS开发或者Xamarin本身。一个解决方法可能是,将构建SDK设置为早期版本,然后清理+重建应用程序。
So I know this has been answered a number of times before, but I have yet to come across a solution that works for me.
The odd thing too, is that the first time I present the Camera from a UIPickerController it works fine, exactly as intended. But then if I open it again it shows just a black screen with the Camera controls ("Cancel" button and white take picture button).
Any help suppressing this error would be greatly appreciated, or even just some confirmation that this is a bug and I just have to wait for Apple to fix it would be a great help!
Thanks all :)
(P.S. I'm running on an iPhone 6 Plus using iOS 8.1)
EDIT: Code (I'm using Xamarin and c#)
public void ShowPhotoTaker (UIViewController vc)
{
UIImagePickerController picker = new UIImagePickerController ();
picker.SourceType = UIImagePickerControllerSourceType.Camera;
picker.FinishedPickingMedia += (object sender,
picker.DismissViewController(true, null);
};
picker.Canceled += (object sender, EventArgs e) => {
picker.DismissViewController(true, null);
};
vc.PresentViewController (picker, true, null);
}
And this is the exact error I get when calling this method
Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
I have had this error for a while too. I've contacted Xamarin Support, and they've told me that this is an error with iOS 8 and higher. There's no solution for this, other than waiting for some bugfix to roll out for iOS development or perhaps Xamarin itself. A workaround might be to set the build SDK to an earlier version and clean + rebuild your application.
这篇关于iOS8截图尚未呈现的视图会导致空快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!