iosswiftwkwebview

How to handle file upload in WKWebView?


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?


Solution

  • 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.