Если я правильно понимаю ваш вопрос, вы определенно можете сохранить фотографию, снятую с камеры, прямо в базу данных, не спрашивая разрешения на доступ к фотогалерее.
Я приведу вам пример коданиже:
func photoOutput(_ captureOutput: AVCapturePhotoOutput, didFinishProcessingPhoto photoSampleBuffer: CMSampleBuffer?, previewPhoto previewPhotoSampleBuffer: CMSampleBuffer?, resolvedSettings: AVCaptureResolvedPhotoSettings, bracketSettings: AVCaptureBracketedStillImageSettings?, error: Error?) {
let imageData = AVCapturePhotoOutput.jpegPhotoDataRepresentation(forJPEGSampleBuffer: photoSampleBuffer!, previewPhotoSampleBuffer: previewPhotoSampleBuffer!)
//set the picture taken as UIImage just in case you'd like to preview the image before saving it
//let image = UIImage(data: imageData!)
let storageRef = Storage.storage().reference().child("\(yourPictureName).jpg")
guard let data = imageData else { return }
storageRef.putData(data, metadata: nil){ (metadata, error) in
guard metadata != nil else {
return
}
storageRef.downloadURL(completion: { (url, error) in
guard let downloadURL = url?.absoluteString else { return }
// save this URL to your database as usual
})
}
}