我需要将它添加到扫描条形码的应用程序中。因此,我需要将参数查询改为resultText:
#https://www.wikifood.eu/wikifood/en/struts/userfoodDB.do?method=getProductOverview&query="resultText"&startAt=0&limit=5&filter=true&loginname=developer&password=4f14f46f76c4b9be2150be579669e699b79f0093 现在我需要创建对数据库的请求。然后接收一些xml文件。
1)我该怎么做?如果我只需要解析结果(xml文件)并将其显示在iPhone上?
2)解析后的结果可以在ImageView中显示吗?
我现在正试着用ASIHTTPRequest http://allseeing-i.com/ASIHTTPRequest/How-to-use来做这件事,但实际上我不知道我应该做什么,除了这个:
- (IBAction)grabURLInBackground:(id)sender
{
NSURL *url = [NSURL URLWithString:@"https://www.wikifood.eu/wikifood/en/struts/userfoodDB.do?method=getProductOverview&query="resultText"&startAt=0&limit=5&filter=true&loginname=NNNNNNNN&password=PPPPPPPPPP"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];}
- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
NSString *responseString = [request responseString];
}
- (void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
}
@end我还应该在委派文件或控制器文件中添加一些东西吗?
谢谢
希望能很快收到你的回音
发布于 2012-10-14 14:14:38
所以我也在使用ASIHTTPRequest。
当我从...requestFinished获取数据时,只需通过调用JSON将其放入NSDictionary (下载here接口)。
举个例子:
NSDictionary *dic = [[request responseString] JSONValue];然后,您可以访问cellForRowAtIndexPath中的数据以在tableView中购买数据。
明白了?
https://stackoverflow.com/questions/11376800
复制相似问题