0
我從客戶端C中獲取鍵值,但在快捷鍵中我不知道怎麼辦?如何檢查nsdictionary中存在的快捷鍵swift並獲得結果數組
NSDictionary *dictResult = [NSJSONSerialization
JSONObjectWithData:jsonData options:0 error:&error];
if ([dictResult objectForKey:@"wsResponse"]!=nil)
{
for (NSDictionary *dict in [[dictResult valueForKey:@"wsResponse"]valueForKey:@"Bhaktamar"])
{
objBean=[[Beandata alloc]init];
objBean.strcontent=[dict objectForKey:@"content"];
objBean.strtitle=[dict objectForKey:@"title"];
[dataBase insertJsonData:@"BhaktamarData" Title:objBean.strtitle Content:objBean.strcontent];
}
}
由於提前
JSON ARRAY
{"wsResponse":{"Bhaktamar":[{"content":"atipati nath","title":"atipatinath"},{"content":"atipati nath","title":"atipatinath"}]}
thanx爲您的迴應,但它不工作 – seggy
**什麼**不工作?該代碼是objc代碼的1:1等效代碼。 – vadian
代碼是等效的,但我運行此代碼從這行快速休息**如果讓wsResponse = dictResult [「wsResponse」]爲? [字符串:任何],讓shlock = wsResponse [「Bhaktamar」]爲? [[String:Any]] ** – seggy