简体   繁体   English

带有JSON解析的Web服务

[英]Web services with JSON Parsing

In my app Web services are created in dot net and i am consuming those and I am getting response.In that all the fields like company,type,location everything are strings and there is no problem with this..And there is one more field called Exhibit number actually it is a Integer but they are created as string only.While I am displaying this it is showing zero instead of that number.. Here is my code... 在我的应用程序中,Web服务是在点网中创建的,我正在使用这些服务,并且得到了响应。在这种情况下,公司,类型,位置等所有字段都是字符串,对此没有任何问题。还有一个字段称为展览编号实际上是一个整数,但它们仅创建为字符串。当我显示此编号时,它显示的是零而不是该编号。这是我的代码...

//Storing into Array
[SurveyFilesArray addObject:[NSDictionary dictionaryWithObjectsAndKeys:[dic objectForKey:@"FileName"],@"FileName",[dic objectForKey:@"ExibhitNumber"],@"ExhibitNumber",[dic objectForKey:@"Description"],@"Description",[dic objectForKey:@"FileQuality"],@"FileQuality",nil]];

//Retrieving from Array..
NSLog(@"???%@???",[NSString stringWithFormat:@"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:@"ExibhitNumber"]intValue]]);
NSLog(@"%d",[[[SurveyFilesArray objectAtIndex:indexPath.row]objectForKey:@"ExibhitNumber"]intValue]);

You have typos in your code. 您的代码中有错别字。

In the order of your code: 按照您的代码顺序:
Ex-ib-hit-Number
Ex-hib-it-Number

These are 2 different strings. 这是2个不同的字符串。

In your example code you save it correctly written as Ex-hib-it . 在示例代码中,您将其正确保存为Ex-hib-it But you try to access it with ex-ib-hit afterwards. 但是您之后尝试使用ex-ib-hit访问它。 This cannot work. 这行不通。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM