ios采用弹出框的情势,让用户自己选择文件的时候遇到权限不足题目,如何办理呢
Failed to read JSON file: Error Domain=NSCocoaErrorDomain Code=257 "The file “data.json” couldn’t be opened because you don’t have permission to view it." UserInfo={NSFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/data.json, NSUnderlyingError=0x303861770 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
出题目的代码
private func openAndReadFile(fileURL: URL) {
// 请求文件访问权限
do {
let data = try Data(contentsOf: fileURL)
DispatchQueue.main.async {
self.parent.onCompletion(data)
}
} catch {
print("Failed to read JSON file:
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |