摄像头在iOS的UIImagepickercontroller中有黑屏
我正面临摄像头在iOS的UIImagepickercontroller中有黑屏,ios,objective-c,camera,uiimagepickercontroller,Ios,Objective C,Camera,Uiimagepickercontroller,我正面临UIIMagePickercontroller中的黑屏预览。我尝试了很多解决方案,但都没有解决。有人能帮我解决这个问题吗?当我打开照片库并选择一些照片,然后在UICollectionview中添加新的cellItem,然后打开相机拍摄新照片,问题就发生了,这种情况经常发生 以下是我用来打开相机的代码: -(void)actionLaunchAppCamera { dispatch_async(dispatch_get_main_queue(), ^{ if ([
UIIMagePickercontroller
中的黑屏预览。我尝试了很多解决方案,但都没有解决。有人能帮我解决这个问题吗?当我打开照片库并选择一些照片,然后在UICollectionview
中添加新的cellItem,然后打开相机拍摄新照片,问题就发生了,这种情况经常发生
以下是我用来打开相机的代码:
-(void)actionLaunchAppCamera
{
dispatch_async(dispatch_get_main_queue(), ^{
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
if (self.cameraPickerController == nil) {
self.cameraPickerController= [[UIImagePickerController alloc] init];
self.cameraPickerController.mediaTypes =[UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
self.cameraPickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
self.cameraPickerController.showsCameraControls = YES;
self.cameraPickerController.allowsEditing = YES;
}
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
// self.cameraPickerController.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto||UIImagePickerControllerCameraCaptureModeVideo;
self.cameraPickerController.delegate = self;
self.cameraPickerController.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.cameraPickerController.cameraFlashMode = UIImagePickerControllerCameraFlashModeOff;
self.cameraPickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.cameraPickerController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:self.cameraPickerController
animated:YES completion:^
{
// BE SURE TO USE a completion block!!!
// completion stuff in here
}];
}
}
});
}
提前感谢。问题不在于您的代码。这是苹果的API。如果您编辑图片,保存图片,然后返回并再次编辑,您可以在Apple contact中看到相同的问题。然后您将有一个黑色预览。用任何方法拍一张照片,然后重复这个过程,这样就可以了。它也在短信图片中这样做。将设备重置为出厂设置,一切都将工作一段时间。我在3个月前向苹果公司汇报了情况,但他们仍然一无所获。有人会想,如果苹果在其核心应用程序中有一个bug报告,他们会修复它。这个问题真的很痛苦,但IOS 6没有任何问题 在Info.plist中将我的捆绑包显示名称设置为“whatever”之前,我尝试了所有方法,但运气不佳 在此之后,应用程序按预期要求获得权限,相机正常工作
我只在这上面浪费了一天,这似乎远远低于StackOverflow的中值。希望它能把其他人从这个折磨人的错误中解救出来。@JulianKról:当然,我有使用摄像头的许可。我们的代码看起来不错,应该可以工作。您是否拒绝访问“设置”中的相机/照片?请检查设置-->隐私-->相机和您的应用程序