title: I upload a picture successfully to the firebase storage but the download url is not stored in the database
body: <p>I'm trying to save the stored image's url in the database however it doesn't successfully do that. It doesn't show any url's in the database as it seemingly skips the instructions in the following saveButton function.</p>
  
  <pre><code>@IBAction func saveButtonClicked(_ sender: Any) {
      let storageRef = Storage.storage().reference().child("profileImages").child(id!)
  
      if let uploadData = profilePicture.image?.pngData(){
  
          storageRef.putData(uploadData, metadata: nil) { (metadata, error) in
              if error != nil{
                  print(error)
                  return
              }
  
              storageRef.downloadURL(completion: { (url, error) in
                  if let downUrl = url {
  
                      Database.database().reference().child("Users").child(self.id!).child("profileImageUrl").setValue(downUrl)
                  }
              })
          }
  
  
  
      }else{
          Database.database().reference().child("Users").child(self.id!).child("profileImageUrl").setValue("default")
  
      }
  
      self.performSegue(withIdentifier: "goToMainPage", sender: self)
  
  }
  </code></pre>
  
  <p>}</p>