我正在开发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上。 有没有人有这种经历?
答案 0 :(得分:1)
您需要使用[String:Any]之类的Dictionary类型。
let arrayUserMatches = ["name":"12", "age": 4]