OGeek|极客世界-中国程序员成长平台

标题: ios - 文件 “IMG_00001.MOV” 无法打开,因为您无权查看它 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:58
标题: ios - 文件 “IMG_00001.MOV” 无法打开,因为您无权查看它

当尝试将视频 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)
}



Best Answer-推荐答案


videoMainData?.write(to: vidUrl

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

关于ios - 文件 “IMG_00001.MOV” 无法打开,因为您无权查看它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44777649/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4