Firebase Storage Warning: downloadURL()' is deprecated: Use `StorageReference.downloadURLWithCompletion()

后端 未结 2 565
梦如初夏
梦如初夏 2020-12-10 19:07

I just updated my project to the latest version of Firebase Storage and I am now getting a warning: downloadURL() is deprecated: Use StorageReference.downloadURLWithComplet

2条回答
  •  心在旅途
    2020-12-10 20:04

    I had the same problem, but I fixed it with this code:

        uploadTask.observe(.success) { snapshot in
            guard let imageURL = snapshot.metadata?.storageReference?.downloadURL(completion: { (url, error) in if error != nil {
                print(error as Any)
            } else {                      //add all you want
    
                }
            }) else { return }
            let imageStr = String(describing: imageURL)
            DBService.manager.updatePhoto(profileImageUrl: imageStr)
            AuthService.manager.updatePhoto(urlString: imageStr)
        }
    
    }
    

提交回复
热议问题