我正在开发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] 删除。
我来说两句