iphoneアプリケーションでjsonデータを解析しています。しかし、それは正しく解析されていません。
次のコードを使用しています。
- (void)getSurveyList {
user_id=user_id;
NSLog(@"This is uerid %@",user_id);
NSArray *tempArray =[[DataManager staticVersion] startParsing:@"http://myser-solutions.com/app/surveyList.php?user_id=user_id"];
for (int i = 0; i<[tempArray count]; i++) {
id *item = [tempArray objectAtIndex:i];
NSDictionary *dict = (NSDictionary *) item;
ObjectData *theObject =[[ObjectData alloc] init];
[theObject setUser_id:[dict objectForKey:@"user_Id"]];
[theObject setSurvey_Id:[dict objectForKey:@"survey_Id"]];
[theObject setSurvey_Name:[dict objectForKey:@"survey_Name"]];
[theObject setTotal_Question:[dict objectForKey:@"total_Question"]];
[theObject setAdministrator_Email:[dict objectForKey:@"administrator_Email"]];
[theObject setStart_Date:[dict objectForKey:@"start_Date"]];
[theObject setEnd_Date:[dict objectForKey:@"end_Date"]];
[theObject setStatus:[dict objectForKey:@"status"]];
[theObject setAdministrator_Email:[dict objectForKey:@"user_Password"]];
[surveyList addObject:theObject];
[theObject release];
theObject=nil;
int count =[surveyList count];
NSLog(@"Total is %d",count);
}
}
コードをデバッグしている間はループに入りません。理由はわかりません。
JSON レスポンス
ali40[{"user_Id":"ali40","survey_Id":"1","survey_Name":"ベリタス調査","total_Questions":"20","administrator_Email":"engr.jamshedali@hotmail.com", "start_Date":"20-9-2012","end_Date":"1-10-2012","status":"Active","user_Password":"jackson12"},{"user_Id":"ali40", "survey_Id":"2","survey_Name":"Celeritas 調査","total_Questions":"20","administrator_Email":"jani_06sw@yahoo.com","start_Date":"10-11-2012"," end_Date":"12-12-2012","status":"Active","user_Password":"jackson12"}]