ios - 文件 “IMG_00001.MOV” 无法打开,因为您无权查看它
<p><p>当尝试将视频 url 转换为数据时出现错误:</p>
<pre><code>"The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it."
</code></pre>
<p>这是我的代码:</p>
<pre><code>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)
}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><code>videoMainData?.write(to: vidUrl</code></p>
<p>尝试在之后添加此行。
<code>videoMainData = videoData.base64EncodedString(options: Data.Base64EncodingOptions.endLineWithLineFeed)</code></p></p>
<p style="font-size: 20px;">关于ios - 文件“IMG_00001.MOV” 无法打开,因为您无权查看它,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/44777649/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/44777649/
</a>
</p>
页:
[1]