我試圖從NSMutableDictionary
採取價值我不能把它,因爲它的多維如何取值從的NSMutableDictionary
{
"seleted_days" = (
TUE,
WED
);
timings = (
(
),
(
),
(
{
"close_time" = "05:00 AM";
"open_time" = "02:00 AM";
timelist = "02:00 AM , 03:00 AM , 04:00 AM , 05:00 AM";
timestat = "1,0,0,1";
}
),
(
{
"close_time" = "05:00 AM";
"open_time" = "02:00 AM";
timelist = "02:00 AM , 03:00 AM , 04:00 AM , 05:00 AM";
timestat = "1,0,0,1";
}
),
(
),
(
),
(
)
);
}
需要從這個NSMutableDictionary
我試圖代碼
let array:NSArray = myretrievedic.value(forKey: "timings") as! NSArray
for i in 0...array.count
{
let subArray:NSArray = array.object(at: i) as! NSArray
if let dict:NSDictionary = subArray.object(at: 0) as! NSDictionary
{
let close_time:String = dict.value(forKey: "close_time") as! String
let open_time:String = dict.value(forKey: "open_time") as! String
print(open_time)
print(close_time)
}
當空談到它崩潰,即使我把要是讓statements.i不明白爲什麼,如果我們不聲明working
請出示你的代碼試圖JSON字符串,我想你應該避免使用SWIFT'NSMutableDictionary',而不是使用SWIFT本地字典類型 – 3stud1ant3