简体   繁体   中英

Camera screen showing only blank black image

I am developing an application which needs iPhone camera access. I am using xcode version 6.3 and swift 1. It was working fine with iOS 8 and currently I updated my iPhone to iOS 9.0.1. And when accessing camera through my application, all I am getting is a blank black screen. This is the sample code I have been using

func CameraAction() {
    imagePicker.sourceType = UIImagePickerControllerSourceType.Camera
    self.presentViewController(imagePicker, animated: true, completion: nil)
    imagePicker.allowsEditing = false
}

I found the solution myself. goto setting -> privacy -> camera and enable or disable camera access for individual apps

This issue seems to occur when the key: "CFBundleDisplayName" has an empty string value in the Info.plist. I added a value and the black screen issue is now fixed!

No luck with above workarounds in iOS 11. Noticed that 'Take Photo' is not appearing in iOS 11 version , Apple might have removed it as its bug. I did not find an Apple link for official confirmation on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM