我是新iphone發展可能有人幫我出這個問題,從一週我與一個問題面臨的,就是我有多個URL像下面多個URL調用
for (int i=0;i<=[listingAffArray];i++)
NSString *urlStr=[NSString stringWithFormat:@"http://demo.holidayjuggle.net:7777/services/inventoryservice/%@/%@/stores/search?location=12.971598700000000000,77.594562699999980000,50",appDelegate.buyingAff,[appDelegate.listingAffArray objectAtIndex:i]];
}
在此
我從所有的網址,但在didfinishloading得到迴應可能無法找到的網址responsedata
NSURL *url=[NSURL URLWithString:urlStr];
NSMutableURLRequest *req=[NSMutableURLRequest requestWithURL:url];
[req setHTTPMethod:@"GET"];
[req setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[req setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
connection=[NSURLConnection connectionWithRequest:req delegate:self];
if(connection){
NSLog(@"connection is successfull ");
}
else{
NSLog(@"connection failed");
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
responseData=[[NSMutableData alloc]init];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
[responseData appendData:data];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSString *strResponse=[[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];
}
在responsedata只有最後的URL數據是在那裏,我把斷點和觀察到的每個URL被調用didfinishloading,當第二網址稱它正在與secondurl調用lik一起進行升級Ë在responsedata最後的URL列表僅存在。如何每個響應數據seperately
由於事先存儲
sivakumari
你能給我示例代碼 – sivakumari
你可以請給我這個戴夫的示例代碼 – sivakumari
你在哪裏遇到問題? – CRDave