Swift 3中的ValueforundefinedKey

斯韦托斯拉夫·阿塔纳索夫(Svetoslav Atanasov)

我正在开发iOS应用程序,我的问题是在使用NSMutableArray时会出现这样的错误。 valueForUndefinedKey this class is not key value coding compliant for the key _id

这是我的源代码。

let arrayUserMatches: NSMutableArray = []
let matchData = self.arrayUserMatches.value(forKey: "_id") as? NSArray

此错误确实在Swift 2.2上发生,在Swift 3上发生。有人有这种经验吗?

流动之星

您需要使用字典类型,例如[String:Any]。

let arrayUserMatches = ["name":"12", "age": 4]

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章