之前都是可以解析图片url地址的,最新报错:403 Forbidden
swift保存图片代码:
if let imageData = image.pngData() {
let file = LCFile(payload: .data(data: imageData))
file.mimeType = "image/png"
//后台保存图片
DispatchQueue.main.async {
_ = file.save { result in
switch result {
case .success:
if let value = file.objectId?.value {
print("文件保存完成。objectId: (value)")
self.MindItems.urlString = (file.url?.stringValue)!
}
case .failure(error: let error):
print(error)
}
}
}
}
解析图片代码:
DispatchQueue.main.async { [self] in
let urlString = cellData.get("urlString")?.stringValue
let url = URL(string: urlString!)
let data = try! Data(contentsOf: url!)
let image = UIImage(data: data)
topViewImage.image = image
}
file文件格式:{
"mime_type": "image/png",
"updatedAt": "2021-07-17T07:09:38.607Z",
"key": "1bfec0c8c71f4a20931dea5dbb0a3116",
"ACL": {
"*": {
"read": true,
"write": true
}
},
"name": "d327cf9b1bdf4f8fb682465fc5e41f3c",
"objectId": "60f282322c88c922c2dd2946",
"createdAt": "2021-07-17T07:09:38.607Z",
"url": "https://lc-fj0Gvm43.cn-n1.lcfile.com/1bfec0c8c71f4a20931dea5dbb0a3116",
"provider": "qiniu",
"metaData": {
"size": 86170
},
"bucket": "fj0Gvm43"
}
解析这个url会报403 forbidden错误