tania_S
tania_S

Reputation: 1370

UIImagePickerController Camera preview is coming black in ios9

I am writing the below code in Xcode 7 and running app in is:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = `enter code here`(id)self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
[self.navigationController presentViewController:picker animated:YES completion:nil];

But Camera preview is coming black in ios9 and I am getting this warning:

My 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

Upvotes: 0

Views: 1303

Answers (2)

tania_S
tania_S

Reputation: 1370

I have finally solved my problem by creating a new project. May be during the upgradation some error occurred because this is happening particularly for my this project. The new project is running with camera & gallery successfully.

Upvotes: 0

Nishant
Nishant

Reputation: 12617

Try this code snippet:

UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType=UIImagePickerControllerSourceTypeCamera;
picker.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.navigationController presentViewController:picker animated:YES completion:nil];

Make sure your device SETTINGS looks like this:

iPhone 6 device settings

Upvotes: 1

Related Questions