Reputation: 98
I am displaying a html page using WKWebView in Swift 5. I have an option to upload image using input file tag. When I run the app and click on upload, it prompts to select Photo library or Camera. If I select camera, the app crashes since the app doesn't have permission.
How to remove camera option or properly request the permission when the user selects camera?
Upvotes: 2
Views: 3883
Reputation: 5287
Regarding your first question - "How to remove camera option":
As far as I know it is not possible. You can either show a dialog which asks for image source (library, camera or Files) or you can select camera only using capture
:
<input type="file" accept="image/*" capture>
Something like capture
, but for Photo Library is not supported.
Check filter options here.
Upvotes: 0
Reputation: 534
I am not sure but you can just set key Privacy - Camera Usage Description in info.plist file with description. Web view will manage for permission and it will work. Please check and let me know if work for you.
Upvotes: 3