2013-08-17 61 views
1

我收到的JSON响应作为阅读整数值

apiResponse =
{ Appointment = 4;
Goals = 0;
Holiday = 0;
LessonPlan = 0;
ServiceLevel = 0;
SiteSetup = 0;
Student = 2;
TherapyLog = 0;
Worksite = 0;
};

我用来得到值作为 NSMutableDictionary* resultTables=[result objectForKey:@"apiResponse"];

int countVals=[[result objectForKey:tablename] intValue] ; 

当我检查

if (countVals>=0) 
{ 
    NSLog(@"Tables Names:%@",tablename); 
    [updatedTables addObject:tablename]; 

}else 
{ 
    NSLog(@"Tables Names:%@",tablename); 
    NSLog(@"no data to update"); 

} 

表名不会添加到updateTables ARRAY。 什么是我的错......

+0

你初始化了更新表吗? – rdelmar

+0

我得到了解决方案。我使用了错误的字典 – sudheer

+0

这是什么表名? –

回答

1
int countVals=[[resultTables objectForKey:tablename] intValue] ; 

您应该使用resultTables拿到表名。