在swift 3中输入any没有下标成员

时间:2016-12-29 13:22:29

标签: swift swift3

downloaed json data is in the format of dictionary and within that dictiionary i need data. so someone please help me to resolve this error(Type any? has no members)

let dict = booksArray[indexPath.row]

title.text = dict["im:name"]!["label"] as? String
descLabel.text = dict["im:releaseDate"]!["attributes"]!!["label"] as? String

1 个答案:

答案 0 :(得分:-1)

我的解决方案

let dataArray = dict["im:releaseDate"] as! NSDictionary

for item in dataArray { // loop through data items
    if (item.key as! String == "attributes") {
        descLabel.text = item.value as? String
    }
}

我希望帮助