Firebase存储上传错误:FIRStorageErrorDomain代码= -13000

时间:2016-07-14 21:33:02

标签: swift firebase storage

我正在尝试将图片上传到Firebase,昨天我实际上成功了几次,但今天我收到了这个错误:

  

可选      - 部分:错误域= FIRStorageErrorDomain代码= -13000&#34;发生未知错误,请检查服务器响应。&#34; UserInfo = {ResponseErrorDomain = FIRStorageErrorDomain,object = ProfileImages / ascascasc ascas.jpg,error_name = ERROR_USER_NOT_FOUND,bucket = ichallenge-c52ae.appspot.com,ResponseErrorCode = -13020,NSLocalizedDescription =发生未知错误,请检查服务器响应。} < / p>

我想重申一下:昨天和今天之间代码没有任何改变,它只是停止了工作。这是代码,我突出显示了注释中出现的行:

@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!)
        }
    }
}

这是XCode中断点的屏幕截图:

I don't understand why the Error says "ERROR_USER_NOT_FOUND", as I haven't tried to authenticate at all

我们将非常感谢您提供的任何帮助。

1 个答案:

答案 0 :(得分:4)

如果您在注销应用时未使用同一用户进行测试,则您的身份验证令牌可能已过期。尝试签出冷杉