Reputation: 667
May be this is duplicate question but I actually didn't find exact solution. I have camera and photo gallery collection view on the same screen.see this UI
When I land to this screen, I get two alerts: one for camera access and other for photo access. Can anyone tell me how to get rid of these native alerts and implement the custom one alert for both the permissions.
Upvotes: 0
Views: 2698
Reputation: 712
You can get the image when picking is done with imagePickerController
First, implement the UIImagePickerControllerDelegate
Second, create an instance and set the delegate
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
Present the imagePicker with
present(imagePicker, animated: true, completion: nil)
And finally
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
let image = info[UIImagePickerControllerOriginalImage] as! UIImage
imagePicker.dismiss(animated: true, completion: nil)
}
Now you have the image.
Upvotes: 1
Reputation: 6251
Whenever you will be add permission details inside your applications <Your App Name>.plist
. App will automatically show default alert message from your .plist
privacy permissions String displaying there because permission message always display in default alert view so you can do one thing before access camera show yours custom alert then redirect to camera/gallery view.
Before accessing camera you can show like this(Example contain only)
Upvotes: 0