How to save a photo in the album?

In order to save a photo in the album you can use different APIs:
  1. ) You can use the simple UIImageWriteToSavedPhotosAlbum() call, which takes an UIImage object as parameter. The problem here is that because the image must be an UIImage, you can no longer save the original(!) photo data. The file format, animations for GIFs and all metadata will be lost.

  2. ) You can use the "PHPhotoLibrary" framework, which can save the original photo data, including animations, metadata etc. So this would be the best option.

The big problem is with the access privileges: I do only want to save photos in the album, not read them. So theoretically I would only need the key "NSPhotoLibraryAddUsageDescription" in the Info.plist. But this only works for the first approach (UIImageWriteToSavedPhotosAlbum). The seconds approach does not work with "NSPhotoLibraryAddUsageDescription", it will just crash and the Xcode console states that the key "NSPhotoLibraryUsageDescription" is required, so this requests not only write access but also read access.

For getting a new iOS 14 entitlement for my App, I am no longer allowed to have the "NSPhotoLibraryUsageDescription" key in the Info.plist, which makes it impossible to save the original photo data in the album (because PHPhotoLibrary requires the key NSPhotoLibraryUsageDescription).

Is the another way to save the original image data in the album? Like an animated GIF, or photos with meta data? Note, I can only have the key "NSPhotoLibraryAddUsageDescription" in the Info.plist?

Replies

I second this problem.

To obtain default browser entitlement, we need to only use "NSPhotoLibraryAddUsageDescription" to increase privacy. However, when saving an image, the app crashes.