iphoneアプリからサーバーからjsonにデータを解析していますが、jsonからデータを取得しません
私は次のコードを使用しています
jsonからデータを取得するには
これが私のjsonデータのリンクです
http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=ali40
NSString*user=@"ali40";
NSString *url=[NSString stringWithFormat:@"http://celeritas-solutions.com/emrapp/surveyDescription.php?user_id=%@",user];
NSLog(url);
NSArray *tempArray =[[DataManager staticVersion] startParsing:url];
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_title:[dict objectForKey:@"survey_Title"]];
[theObject setSurvey_Description:[dict objectForKey:@"survey_Description"]];
[theObject setDate_Created:[dict objectForKey:@"date_Created"]];
[surveyList addObject:theObject];
[theObject release];
theObject=nil;
int count =[surveyList count];
NSLog(@"Total is %d",count);
DataManagerクラス
DataManager * theInstance;
+ (id)staticVersion{
if(!theInstance){
theInstance = [[DataManager alloc] init];
}
return theInstance;
}
- (NSMutableArray *) startParsing:(NSString *)theURLString {
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",theURLString]];
NSString *fileContent= [NSString stringWithContentsOfURL:url];
SBJSON *parser = [[SBJSON alloc] init];
NSDictionary *data = (NSDictionary *) [parser objectWithString:fileContent error:nil];
NSArray *items = (NSArray *) data ;
return items;
int count=[items count];
NSLog(@"This is testing %d",count);
}