Ios 文件“;IMG_00001.MOV”;不能’;无法打开,因为您没有’;我没有查看它的权限

Ios 文件“;IMG_00001.MOV”;不能’;无法打开,因为您没有’;我没有查看它的权限,ios,swift3,Ios,Swift3,尝试将视频url转换为数据时出错: "The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it." 这是我的密码: let videoUrl = Dictionary.object(forKey: "videoUrl") as! String do { let vidUrl = URL(fileURLWithPath: videoUrl) let vide

尝试将视频url转换为数据时出错:

"The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it."
这是我的密码:

let videoUrl = Dictionary.object(forKey: "videoUrl") as! String

do {
    let vidUrl = URL(fileURLWithPath: videoUrl)

    let videoData = try Data.init(contentsOf: vidUrl)
    videoMainData = videoData.base64EncodedString(options: Data.Base64EncodingOptions.endLineWithLineFeed)
} catch let error as NSError {
    print(error.localizedDescription)
}
videoMainData?写入(至:vidUrl

尝试在..之后添加此行。。
videoMainData=videoData.base64EncodedString(选项:Data.Base64EncodingOptions.endLineWithLineFeed)

但是bro
videoMainData=videoData.base64EncodedString(选项:Data.Base64EncodingOptions.endLineWithLineFeed)
由于进程将在try语句之后捕获,所以此行不会执行。let vidUrl=URL(fileURLWithPath:videoUrl)让videoData=NSData.init(contentsOf:vidUrl)做{try videoData?.write(to:vidUrl)}catch{}试试上面的几行,这在我的项目中对我有效,我只是将URL转换为NSData,如上所示。。