2017-06-23 70 views
0

我得到一個編譯時錯誤,它阻止了我在Xcode中運行我的應用程序。我收到錯誤 - 模塊'FirebaseDatabase'沒有名爲'database'的成員。而且我還會在幾行內容中看到同樣的錯誤,但是有了存儲空間。錯誤 - 模塊「FirebaseStorage」沒有名爲「存儲」的成員。錯誤 - 模塊'FirebaseDatabase'在Xcode中沒有名爲'database'的成員

//Error Below - Module 'FirebaseDatabase' has no member named 'database' 
let location = FirebaseDatabase.database().reference().child("users").child(userUid) 

    location.setValue(userData) 
     dismiss(animated: true, completion: nil) 

} 
func uploadImg() { 
    if usernameField.text == nil { 
     signUpBtn.isEnabled = false 
    } else { 
      username = usernameField.text 
      signUpBtn.isEnabled = true 
    } 
    guard let img = userImagePicker.image, imageSelected == true else { 
     print("image needs to be selected") 
     return 
    } 
    if let imgData = UIImageJPEGRepresentation(img, 0.2) { 
     let imgUid = NSUUID().uuidString 
     let metadata = StorageMetadata() 
     metadata.contentType = "image/jpeg" 


//Error Below - Module 'FirebaseStorage' has no member named 'storage' 
FirebaseStorage.storage().reference().child(imgUid).putData(imgData, metadata: metadata) { (metadata, error) in 
      if error != nil { 
       print ("did not upload image") 
      } else { 
       print("uploaded") 
       let downlloadURL = metadata?.downloadURL()?.absoluteString 
       if let url = downloadURL { 
        self.setUser(img: url) 
       } 
      } 
     } 
    } 
} 

回答

0
FirebaseStorage.storage() 

應該

Storage.storage() 

這同樣適用於FirebaseDatabase(數據庫)。

相關問題