简体   繁体   中英

The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it

When try convert video url to data then getting error:

"The file “IMG_00001.MOV” couldn’t be opened because you don’t have permission to view it."

Here is my 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)
}

videoMainData?.write(to: vidUrl

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM