【发布时间】:2015-01-08 07:08:22
【问题描述】:
我在这里做错了什么。我正在使用 SwiftyJSON。第一行打印正确的值。我在第二行收到一条错误消息:找不到成员字符串。我不应该能够在这里获取字符串值吗?
println(json["weather"][0]["description"]) // prints the correct value
if let description = json["weather"][0]["description"].string {
self.descriptionLabel.text = description
}
【问题讨论】:
-
你为什么要做.string??就做
let description = json["weather"][0]["description"] -
你可能在一个不起作用的字符串上调用 .string,删除 .string
标签: json swift swifty-json