App crashing when saving photos from WKWebView

by

I stumbled upon a crash in my app. In my app I have a WKWebView that lets user access web. I tried saving image from a website by long pressing - general way we do in our iOS safari - and app crashed. This user experience behaviour of long pressing and saving image is very common.

The crash error is:

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value explaining to the user how the app uses this data.

My app doesn’t have the permission to write photo to device for there is no such feature in the app that requires photo write permission. Crash makes sense and this infact is considered an indirect feature where user may try to save photos from WKWebView into device. I should handle this user function too that requires write permission.

Simple solution is to include the NSPhotoLibraryAddUsageDescription permission entry to info.plist of the project.

You might also like: UIImagepicker controller allowsEditing not working

More Articles

Recommended posts