I tried everything but every time I try to upload this video I got this error. Error
Domain=NSCocoaErrorDomain Code=257 "The file “IMG_1773.MOV” couldn’t be opened because you don’t have permission to view it."
[![fileprivate func getVideoFromasset() {
let imgManager = PHImageManager.default()
let fetchVideos = PHVideoRequestOptions()
fetchVideos.isNetworkAccessAllowed = true
fetchVideos.deliveryMode = .automatic
guard let asset = self.videoAsset else {
return
}
imgManager.requestPlayerItem(forVideo: asset, options: fetchVideos, resultHandler: { (data, info) in
guard let video = data?.asset as? AVURLAsset else { return }
print(video.url)
self.urlAsset = video.url
self.getVideoFromUrl(url: video.url)
})
}
@objc fileprivate func UploadVideo() {
guard let url = self.urlAsset else {return}
print(url.absoluteString)
if self.videoUrl == nil {
do {
let filedat = try Data(contentsOf: url)
let pffile = PFFile(name: "sdsd", data: filedat)
pffile?.saveInBackground({ (data, error) in
print(error)
}, progressBlock: { (intt) in
print(intt)
})
} catch {
print(error)
}
} else {
print(self.videoUrl)
print("upload from url file")
}
}][1]][1]
Error Domain=NSCocoaErrorDomain Code=257 "The file “IMG_1773.MOV” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/var/mobile/Media/DCIM/101APPLE/IMG_1773.MOV, NSUnderlyingError=0x174254280 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
file:///var/mobile/Media/DCIM/101APPLE/IMG_1773.MOV
I need help!!!!