Reputation: 541
I'm facing the black screen preview in UIIMagePickercontroller
. I tried many solutions but cannot solved that. Any body can help me to solve that? It's always happens when I open the photo library and select some photos, then add new cellItem in UICollectionview
, after that I open camera to take new photo and the issue is happened.
Here is my code used to open Camera:
-(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
}];
}
}
});
}
Thanks in advance.
Upvotes: 1
Views: 1824
Reputation: 21
I tried everything without luck until I set my Bundle Display Name to "whatever", in the Info.plist.
After this, the app asked for permissions as expected and the camera works.
I only wasted a day on this, which seems well below the median on StackOverflow. Hope it rescues others from this torturous bug.
Upvotes: 2
Reputation: 1
The problem is not your code. It's apple's API. You can make see the same problem in Apple contact, if you edit the picture, save it and then go back and edit it agin. Then you will have a black preview. Take a picture any way and repeat the process, then it will be fine. It also does it in text message picture. Reset the device to factory settings and everything will work for a while. I have reported to Apple 3 months ago and still nothing from them. One would think if Apple had a bug report in their core apps they would fix it. This problem has really been a pain and yet IOS 6 had no problems.
Upvotes: 0