我有这个奇怪的问题. NSDictionary没有返回正确的整数值.
{ "status":"ok","error_code":0,"data" : [],"msg":"everything is working!" }
JSON正在转换为NSDictionary.
NSError *error = nil; NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error: &error];
我使用以下代码访问NSDictionary值.
int error_code = (int)[jsonDict valueForKey:@"error_code"] NSLog(@"%i",error_code); The log outputs the following: 143005344
我甚至尝试了objectForKey,并得到相同的回复.
提前致谢.