[default] Failed to issue sandbox token for URL get error when share video in IOS 14, but IOS < 14 worked

I get error when share video with UIActivityViewController in IOS > 14, but under IOS 14 worked fine, I don't know why?

2021-03-15 23:55:20.866820+0700 AnyBackup[3249:1433997] Could not create sandbox extension. Error: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedDescription=Could not create sandbox extension of type com.apple.app-sandbox.read for URL /var/mobile/Media/DCIM/100APPLE/IMG_0415.MOV. Error: Operation not permitted}

2021-03-15 23:55:20.867564+0700 AnyBackup[3249:1457502] [default] Failed to ssue sandbox token for URL: 'file:///var/mobile/Media/DCIM/100APPLE/IMG_0415.MOV' with error: 'Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" UserInfo={NSLocalizedDescription=Cannot issue a sandbox extension for file "/var/mobile/Media/DCIM/100APPLE/IMG_0415.MOV": Operation not permitted}'
Update: Problem solved
First of all make sure your video available in your DocumentDirectory and than you can share it via URL of Directory like below.

Share Video with URL:
Code Block
let url = self.documentDirectory().appendingPathComponent("yourFilename")
let share = UIActivityViewController(activityItems: [url], applicationActivities: nil)
share.popoverPresentationController?.sourceView = self.view
self.present(share, animated: true, completion: nil)

Get URL of DocumentDirectory:
Code Block
func documentDirectory() -> URL {
let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
return documentsDirectory
}

[default] Failed to issue sandbox token for URL get error when share video in IOS 14, but IOS &lt; 14 worked
 
 
Q