我正面临一个问题,我在服务器
的响应字符串之下服务器响应==
{"status":1,"userId":"501600688052021","mobile":" 916236365"}
但是当我将其保存到Dictionary时,很少有字符串值被转换为Integer。如下所示" userId" val现在是整数,移动值是保留的字符串。
Response dictionary formed is ={
userId = 501600688052021;
mobile = " 916236365";
status = 1;
}
以下是代码
[request setHTTPMethod:@"POST"];
NSData *data = [paramString dataUsingEncoding:NSUTF8StringEncoding];
[request setHTTPBody:data];
NSURLResponse *response;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSString *resSrt = [[NSString alloc]initWithData:responseData encoding:NSASCIIStringEncoding];
NSLog(@"Server Response ==%@", resSrt);
if(resSrt.length)
{
responseDictionary = [NSJSONSerialization JSONObjectWithData:resSrt options:0 error:&err];
NSLog(@"Response dictionary formed is =%@", responseDictionary);
}