IOS Camera Note (II)
Camera Authorization
- Add
NSCameraDescription(Privacy-Camera Usage Description) key in info.plist to describe the need for using camera. - Test authorization before each camera setup.
- Test
AVCaptureDevice.authorizationStatus(for:), four results are possible: 1..authorized,.denied,.restricted2. Upon.notDetermined, userequestAccess(for:completionHandler:)to prompt user. NotecompletionHandleris async execution. - Test authorization before saving media.
PHPhotoLibraryandPHAssetCreationRequestprovide read/write function for Photos library. AddNSPhotoLibraryUsageDescriptionto info.plist.UISavePhotoAtPathtoSavedPhotosAlbumprovide an easier access to save movie files. AddNSPhotoLibraryAddUsageDescriptionto info.plist.