我在让名字=候选人[“候选人姓名”]时得到这个错误!:
type nsfastenumerationiterator.element aka any has no subscript members
let url = URL(string: "https://website.com") let data = try? Data(contentsOf: url!) var tmpValues = try! JSONSerialization.jsonObject(with: data!,options: JSONSerialization.ReadingOptions.mutableContainers) as! NSArray tmpValues = tmpValues.reversed() as NSArray reloadInputViews() for candidate in tmpValues { if ((candidate as? NSDictionary) != nil) { let names = candidate["CandidateName"]! //self.values.append(candidate["CandidateName"]) self.values.append(name!) print(name) } }