1

I am trying to export iCloud assets through AVAssetReader and AVAssetWriter but AVAssetReader fails to initialise using that asset. All other videos are working fine. Only iCloud shared album videos are causing trouble. The error AVAssetReader gives me is under:

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-17507), NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x2812d8ae0 {Error Domain=NSOSStatusErrorDomain Code=-17507 "(null)"}}

Is there any why to fix it or is there any other alternative ?

1 Answers1

0

When requesting the asset using PHImageManager, setting the deliveryMode property of the PHVideoRequestOptions instance to mediumQualityFormat or fastFormat might be the cause of the problem you're experiencing. Try using auto or high quality, because according to the docs, those are the only modes supported when exporting.

let videoRequestOptions = PHVideoRequestOptions()
videoRequestOptions.deliveryMode = .highQualityFormat
videoRequestOptions.isNetworkAccessAllowed = true

PHImageManager.default().requestAVAsset(forVideo: asset, options: videoRequestOptions) { (asset, audioMix, info) in
            // Use the returned asset 
        }
Cihan Tek
  • 5,349
  • 3
  • 22
  • 29
  • I am already using high quality format and my network access is allow but still facing the same issue with iCloud assets. – Muhammad Adeel Tahir Apr 17 '21 at 11:09
  • That's interesting. I ran into the same issue and that solved that problem. It wasn't a viable solution for me though because I didn't want to download high quality a version. You can find out more if you look at [my question](https://stackoverflow.com/questions/66818642/avassetexportsession-fails-to-export-videos-downloaded-from-icloud) – Cihan Tek Apr 17 '21 at 12:54