SwiftyJSON无法获得字符串

时间:2015-01-08 07:08:23

标签: json swift swifty-json

我在这里做错了什么。我正在使用SwiftyJSON。第一行打印正确的值。我在第二行收到错误说:找不到成员字符串。我不应该在这里得到字符串值吗?

println(json["weather"][0]["description"])    // prints the correct value
if let description = json["weather"][0]["description"].string {
    self.descriptionLabel.text = description
}

1 个答案:

答案 0 :(得分:0)

试试这个

descriptionLabel.text = json["weather"][0]["description"].stringValue