【发布时间】:2017-03-15 01:59:13
【问题描述】:
var tempJSON:JSON = ""
tempJSON = JSON(self.userdefaults.string(forKey: "currentOrder"))
print(tempJSON)
产量:
{"7": "1", "21": "0", "20": "0", "3": "1"}
我需要能够循环通过它,但不能。 我试过了。
for(key,value) in tempJSON{
print(key)
}
没有任何输出....
谢谢
【问题讨论】:
-
做
tempJSON.enumerated()或者干脆做for item in tempJSON{ print(item)index 那么你必须使用@987654327 @ -
很抱歉不知道如何在swiftyjson中枚举
-
为什么它不起作用?它对我来说很好,不需要
enumerated(),因为它是(key,value)对,而不是(index,value)对
标签: ios json swift swifty-json