gpt4 book ai didi

swift - 此类不符合键名的键值编码。

转载 作者:可可西里 更新时间:2023-10-31 23:58:32 26 4
gpt4 key购买 nike

<分区>

我创建了一个名为 Users 的类,如下所示

public class Users: NSObject {
var name: String?
var email: String?
}

和其他类创建用户类数组

var regUser = [Users]()

func fetchUser(){
Database.database().reference().child("users").observe(.childAdded, with: {(DataSnapshot) in
if let dictionary = DataSnapshot.value as? [String: AnyObject]{
let user = Users()

user.setValuesForKeys(dictionary)
self.users.append(user)

DispatchQueue.main.async {
self.tableView.reloadData()
}
print(user.email)
}
}, withCancel: nil)
}

出现以下错误:

"Users 0x60400028fdc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name."

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com