我正在观看教程,我想使用现有的代码编写并将其添加到我的firebase中。我已成功创建帐户并导入已下载的GoogleService-Info。在那里没有其他修改
现在我想创建一个用户,但它不起作用。
我收到此错误:
'NSInvalidArgumentException',原因:'提供的存储桶:random.appspot.com与当前实例的存储桶不匹配:random2.appspot.com'
内部火力储存:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write: if request.auth != null;
}
}
}
在Swift里面:
static func signUp(username: String, email: String, password: String, imageData: Data, onSuccess: @escaping () -> Void, onError: @escaping (_ errorMessage: String?) -> Void) {
Auth.auth().createUser(withEmail: email, password: password) { (authData: AuthDataResult?, error: Error?) in
if error != nil {
onError(error!.localizedDescription)
return
}
let uid = authData!.user.uid
let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOF_REF).child("profile_image").child(uid)
storageRef.putData(imageData, metadata: nil, completion: { (_, error: Error?) in
if error != nil {
return
}
storageRef.downloadURL(completion: { (url: URL?, error: Error?) in
if let profileImageUrl = url?.absoluteString {
self.setUserInfomation(profileImageUrl: profileImageUrl, username: username, email: email, uid: uid, onSuccess: onSuccess)
}
})
})
}
}
我可以看到在我的firebase中创建的用户,但就是这样。另一方面,配置文件图像不起作用。即使存储已激活。有什么建议?