我可以将照片放到Firebase存储中:
func SendAdvertisesToFireBase(_ data: SkelbimasModel) {
var links = [String]()
for image in data.nuotraukos {
print(image)
if let uploadData = UIImagePNGRepresentation(image) {
//let imageNames = NSUUID().uuidString
let store = Storage.storage().reference().child("images").child("image.png")
store.putData(uploadData, metadata: nil, completion: { (metadata, error) in
if (error != nil) {
print(error as Any)
print("nepaejo")
return
}
print("paejo")
let address = metadata?.downloadURL()?.absoluteString
links.append(address!)
})
}
}
self.AddDataAfterImageAdded(self.skelbimas, links)
}
print(image)
打印图像。
let store =Storage.storage().reference().child("images").child("image.png"
显示有一个引用,但未调用store.putData(...)
。我没有错误。