##エラーメッセージ部分を抜粋
// profile image url guard let profileImageURL = metadate?.downloadURL()?.absoluteString else { return } 上の構文でエラーメッセージ Value of type 'StorageMetadata' has no member 'downloadURL' //user id guard let uid = user?.uid else { return } 上の構文でエラーメッセー Value of type 'AuthDataResult' has no member 'uid' let dictionaryValues = ["name": fullName, "username": username, "profileImageUrl": profileImageURL] let values = [uid: dictionaryValues] // save user info to database Database.database().reference().child("users").updateChildValues(dictionaryValues, withCompletionBlock: { (error, ref) in print("Successfully created user and saved information to database") }) }) } }
##当該セクションを抜粋
Auth.auth().createUser(withEmail: email, password: password) { (user, error) in //handle error if let error = error { print("Falled to create user with error: ", error.localizedDescription) return } // set profile image guard let profileImg = self.plusPhotoBtn.imageView?.image else { return } // update date change // guard let uploadData = UIImageJPEGRepresentation(profileImg, 0.3) else { return } guard let uploadData = profileImg.jpegData(compressionQuality: 0.3) else { return } // place image in firebase storage let filename = NSUUID().uuidString Storage.storage().reference().child("profile_image").child(filename).putData(uploadData, metadata: nil, completion: { (metadate, error) in // handle error if let error = error { print("Failed to upload image to Firebase Storage with error", error.localizedDescription) } // profile image url ここでエラー guard let profileImageURL = metadate?.downloadURL()?.absoluteString else { return } //user id ここでエラー guard let uid = user?.uid else { return } let dictionaryValues = ["name": fullName, "username": username, "profileImageUrl": profileImageURL] let values = [uid: dictionaryValues] // save user info to database Database.database().reference().child("users").updateChildValues(dictionaryValues, withCompletionBlock: { (error, ref) in print("Successfully created user and saved information to database") }) }) } }
ここ2日ハマっています。xcode10.1で開発してます。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/23 06:25