GFV*_*450 2 storage firebase swift
我正在尝试将图像上传到 Firebase,实际上我昨天成功了几次,但今天我收到了这个错误:
可选 - Some : Error Domain=FIRStorageErrorDomain Code=-13000 “发生未知错误,请检查服务器响应。” UserInfo={ResponseErrorDomain=FIRStorageErrorDomain, object=ProfileImages/ascascasc ascas.jpg, error_name=ERROR_USER_NOT_FOUND, bucket=ichallenge-c52ae.appspot.com, ResponseErrorCode=-13020, NSLocalizedDescription=发生未知错误,请检查服务器响应。}
我想重申:昨天和今天之间的代码没有任何变化,它只是停止工作。这是代码,我用注释突出显示了它发生的行:
@IBAction func signUpButtonPressed(sender: AnyObject)
{
// If textfields have more than 3 characters
if firstNameTextField.text!.characters.count > 3 && passwordTextField.text!.characters.count > 3 && emailTextField.text!.containsString("@")
{
createUser()
//Goes to Main Storyboard
parseOutdated.signUpInBackgroundWithBlock { (success: Bool, error: NSError?) in
NSNotificationCenter.defaultCenter().postNotificationName("Login", object: nil)
}
}
else
{
firstNameShake.shakeAnimation()
lastNameShake.shakeAnimation()
passwordShake.shakeAnimation()
emailShake.shakeAnimation()
}
}
func createUser()
{
//Unwrap optionals before pushing to Firebase Database
let name: String = "\(self.firstNameTextField.text!) \(self.lastNameTextField.text!)"
storeProfileImage(name)
}
func storeProfileImage(name: String)
{
let profileImageData = UIImageJPEGRepresentation(self.profileImageView.image!, 1.0)
// Create a reference to the file you want to upload
let profileImageRef = storageRef.child("ProfileImages/\(name).jpg")
// Upload the file to the path defined above
profileImageRef.putData(profileImageData!, metadata: nil) { metadata, error in
if (error != nil) //ERROR HAPPENS HERE
{
print("Image not stored: ", error?.localizedDescription)
}
else
{
//Stores the profile image URL and sends it to the next function
let downloadURL = metadata!.downloadURL()
self.storeUserData(name, profileImageURL: downloadURL!)
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是 XCode 中断点的屏幕截图:
提供的任何帮助将不胜感激。
| 归档时间: |
|
| 查看次数: |
2020 次 |
| 最近记录: |