我有API,它看起來像 #https請求API://www.wikifood.eu/wikifood/en/struts/userfoodDB.do方法= getProductOverview &查詢= 4016249502058 & startAt = 0 &上限= 5 &過濾=真&登錄名=開發商&密碼= 4f14f46f76c4b9be2150be579669e699b79f0093HTTPS爲iPhone
我需要將它添加到我的應用程序,掃描條形碼。所以參數查詢我需要更改爲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
我應該ALSE添加的東西代理文件或控制器文件?
感謝
希望聽到你很快
你如何訪問'ASIHTTPRequest'函數? – 2012-08-10 04:29:00