Could not create sandbox extension when share video in IOS >14, but iOS 13 worked

I get error when share video with UIActivityViewController in IOS>14, but iOS 13 worked fine

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}'

I need a help ? thankyou
Have you declared all the required entries in info.plist ?
I had declared required entries in info.plist, but I don't know missing any thing????
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
}

AVURLAsset *urlAsset = (AVURLAsset *)asset; I read directly from the class urlAsset.URL and the share also reports this error

Could not create sandbox extension when share video in IOS >14, but iOS 13 worked
 
 
Q