thread 1 exc_bad_instruction(code = exc_i386_invop subcode = 0x0)PhotoUrl error

时间:2017-07-20 00:04:18

标签: swift

尝试保存用户photoURL时出现以下错误。任何想法为什么?

databaseRef.child("users(Auth.auth().currentUser?.uid)").observe(.value, with: { (snapshot) in
    DispatchQueue.main.async {
        let user = Userdata(snapshot: snapshot)
        self.username.text = user.username
        self.country.text = user.country
        self.email.text = user.email

        let imageUrl = String(user.photoUrl) // this is where I get the error

        self.storageRef.reference(forURL: imageUrl!).getData(maxSize: 1 * 1024 * 1024, completion: { (data, error) in
            if let error = error {
                print(error.localizedDescription)
            }else {
                if let data = data {
                    self.userImageView.image = UIImage(data: data)
                }
            }
        })
    }

0 个答案:

没有答案