更新时间:2023-01-03 14:32:45
我现在遇到相同的问题.上载在Simulator中的效果很好,但是在设备上却出现了权限错误.我的解决方法是将图像作为数据而不是与文件的URL一起上传:
I'm having the same problem right now. Uploading works fine in the Simulator, but on a device it gives me the permission error. My workaround has been to upload the image as data rather than with the URL to the file:
let imageData = UIImageJPEGRepresentation(image, 1.0)
let uploadTask = storageReference.child(remoteFilePath).putData(imageData, metadata: metadata, completion: { (metadata, error) in
// Your code here
}