Image url in FirebaseStorage does not exist., ResponseErrorDomain=com.google.HTTPStatus, ResponseErrorCode=404}?

后端 未结 1 1535
梦谈多话
梦谈多话 2020-12-22 09:23

I have code which saves multiple images into firebase. I updated my pods, and after this I had to change my downloadURL code. After doing so the urls are not showing up in t

相关标签:
1条回答
  • 2020-12-22 09:52

    You are probably using a different URL storage ref for the put data method the two blocks are within.

    You may have something like this where childStorageRef is a different ref than storageRef:

      childStorageRef.putData(uploadData, metadata: nil) { (metadata, err) in
        storageRef.downloadURL { (url, error) in
    
               if error != nil {
                   print("Failed to download url:", error!)
                   return
               }
    
               let imageUrl = "\(String(describing: url))"
                    postRef.child(autoID).setValue(imageUrl)
                }
           }
    

    Change that ref to this:

    storageRef.putData(uploadData, metadata: nil) { (metadata, err) in
        storageRef.downloadURL { (url, error) in
    
           if error != nil {
               print("Failed to download url:", error!)
               return
           }
    
           let imageUrl = "\(String(describing: url))"
                postRef.child(autoID).setValue(imageUrl)
            }
       }
    

    Same thing for block 2. Hope this helps!

    0 讨论(0)
提交回复
热议问题