我在iOS開發新的,我打電話返回我的數據,如JSON響應和NSDictionary的
[
{
"ID": "3416a75f4cea9109507cacd8e2f2aefc3416a75f4cea9109507cacd8e2f2aefc",
"Name": "2M Enerji"
},
{
"ID": "072b030ba126b2f4b2374f342be9ed44072b030ba126b2f4b2374f342be9ed44",
"Name": "Çedaş"
},
{
"ID": "093f65e080a295f8076b1c5722a46aa2093f65e080a295f8076b1c5722a46aa2",
"Name": "Çelikler"
},
{
"ID": "7cbbc409ec990f19c78c75bd1e06f2157cbbc409ec990f19c78c75bd1e06f215",
"Name": "Çoruh EDAŞ"
},
{
"ID": "70efdf2ec9b086079795c442636b55fb70efdf2ec9b086079795c442636b55fb",
"Name": "İçdaş"
}
]
現在我試圖讓它陣列中的Web服務,該陣列將是獨立的名稱和ID,我做了,直到採取在NSDICT下面是我的代碼
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(@"finish loading");
NSString *loginStatus = [[NSString alloc] initWithBytes:[webData mutableBytes]
length:[webData length]
encoding:NSUTF8StringEncoding];
NSString *responsewith = [[NSString alloc] initWithData:webData
encoding:NSUTF8StringEncoding];
//providerData = [NSKeyedUnarchiver unarchiveObjectWithData:webData];
providerDropData = [NSString stringWithFormat:responsewith];
NSLog(@"drop %@",providerDropData);
NSArray *providerData = [providerDropData valueForKey:@"ID"];
NSLog(@"jey %@",responsewith);
NSLog(@"resonser %@",responsewith);
NSLog(@"laoding data %@",loginStatus);
//greeting.text = loginStatus;
[loginStatus release];
[connection release];
[webData release];
}
,當我試圖保存NSDictionary
到NSArray
爲@"ID"
應用得到墜毀。
請幫
NSDICT ???那是什麼? – Tirth
「應用程序崩潰」 - 這是非常具有描述性的。謹慎解釋這意味着什麼,錯誤是什麼? –
您需要枚舉字典並將字符串對象添加到數組中。 – suhit