Have you query user album or create a new album in your code?
I faced the similar problem as you describe.
However I found that my app not only add photo but also query and create album.
I used:
PHAssetCollection.fetchAssetCollections
PHAssetCollectionChangeRequest.creationRequestForAssetCollection
These are my usages:
private func getAlbum() -> PHAssetCollection? {
let fetchOptions = PHFetchOptions()
fetchOptions.predicate = NSPredicate(format: "title = %@", "[myAppAlbumName]")
let collection = PHAssetCollection.fetchAssetCollections(with: .album, subtype: .any, options: fetchOptions)
guard let firstObject = collection.firstObject else {
return nil
}
return firstObject
}
private func createAlbum(_ completionHandler: @escaping(_ isSuccess: Bool, _ error: Error?) -> ()) {
PHPhotoLibrary.shared().performChanges({
PHAssetCollectionChangeRequest.creationRequestForAssetCollection(withTitle: "[myAppAlbumName]")
}) { (isSuccess, error) in
completionHandler(isSuccess, error)
}
}
After trying not call those two functions, iPhone doesn't prompt 'read write' dialog anymore!
(Both API cause the issue)
I am not happy about Apple's changes.
Even retrieve the metadata in photo require 'read write' dialog.
Developers can do much few things than before....