I am attempting to construct an messageExtension app and I would like it to take an image utilizing the iphone digital camera. I do know that I want so as to add the NSCameraUsageDescription in my Data.plist file and I’ve executed that. I’ve tried to one thing related with a standard ios app and it labored superb; nevertheless once I do it in my message app it doesn’t work.
Right here connected are some screenshots and the code i take advantage of to name to open the digital camera. I really feel I have been working in circles so any concepts would assist.
personal func openCamera() {
print("open digital camera!!!!")
swap AVCaptureDevice.authorizationStatus(for: .video) {
case .approved: // the consumer has already approved to entry the digital camera.
print("approved")
self.setupCaptureSession()
case .notDetermined: // the consumer has not but requested for digital camera entry.
print("not det")
AVCaptureDevice.requestAccess(for: .video) { granted in
if granted { // if consumer has granted to entry the digital camera.
print("the consumer has granted to entry the digital camera")
self.setupCaptureSession()
} else {
print("the consumer has not granted to entry the digital camera")
self.handleDismiss()
}
}
case .denied:
print("the consumer has denied beforehand to entry the digital camera.")
self.handleDismiss()
case .restricted:
print("the consumer cannot give digital camera entry resulting from some restriction.")
self.handleDismiss()
default:
print("one thing has improper resulting from we won't entry the digital camera.")
self.handleDismiss()
}
}