解析我試圖收杆JSON數據並顯示在表 我的JSON數據是這樣的收到錯誤的JSON在iphone
{"isError":false,"ErrorMessage":"","Result":{"Count":4,"Data":[{"ContentID":"127_30_1309793318065","ContentTypeID":1,"UserCaption":"Gandhinagar(Kanjurmarg)","UserComment":"central\n","DateRecorded":"\/Date(1309793318000+0530)\/","Data":"","ShareType":true,"Views":0,"PlayTime},{},{},{}];};isError = 0;}
我prasing這樣
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *loginStatus = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[webData length] encoding:NSUTF8StringEncoding];
NSLog(@"%@",loginStatus);
//this is for the getting the data from the server with help of JSON
NSString *json_string = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];
NSDictionary *result = [json_string JSONValue];
/
//this for holding the Array value which come from the server
NSMutableArray *results = [[NSMutableArray alloc] init];
for (int index = 0; index<[reviewsvalues count]; index++)
{
NSMutableDictionary * value = [reviewsvalues objectAtIndex:index];
ReviewsResult * result = [[ReviewsResult alloc] init];
result.User_Caption = [value objectForKey:@"UserCaption"];
result.ContentType_Id = [value objectForKey:@"DateRecorded"];
result.Average_Rating = [value objectForKey:@"AverageRating"];
//OVER here MY APP GET CRASH
}
}
但它會崩潰並給出錯誤
[__NSCFDictionary objectAtIndex:]:無法識別的選擇器發送到實例
是的,你是對的,但像這樣做NSArray * reviewsArray = [評論值valueForKey:@「數據」];但?我該如何設置單元格的值以及如何計算行 – Harish
@Harish:reviewArray在其每個索引中都包含一個字典。 –
你可以來stackchat上的在線聊天 – Harish