Open Taufi opened 4 weeks ago
I worked on improving the PR based on the reviewers' recommendations:
First, I updated the saveImage(url:)
function in MediaUIView.swift
as recommended by D. Prodano. I kept the second if
clause to initiate the image download immediately after requesting authorization. I can change this if preferred, but it would then require the user to manually restart the download after granting authorization.
Additionally, I added the NSPhotoLibraryAddUsageDescription
, following Ankush's recommendation.
If the user has not yet granted permission to download photos, they will be asked to do so:
PHPhotoLibrary.requestAuthorization(for: .addOnly)
. Afterward, the photos can also be downloaded to the desktop. Previously, broader access was granted (requestAuthorization(_:)
), but this method is now deprecated. Apparently, Mac Catalyst support for more advanced permission checks is still not fully developed. Once permission is denied, it can no longer be granted in the settings. You have to do it via a terminal command:'tccutil reset PhotosAdd <your.app.bundle.identifier>'
.