0
네트워크 큐를 만들어 두 요청을 보내고 있습니다.이 두 요청을 네트워크 큐에 추가했습니다. 에 내가 responce을 얻고 내 responce 확인을위한네트워크 큐가 두 번째 요청에 응답하지 않습니다.
-(void)viewDidLoad
{
[super viewDidLoad];
ASINetworkQueue *networkQueue = [[ASINetworkQueue queue] retain];
NSURL *url = [NSURL URLWithString:@"http://www.w3schools.com/xml/simple.xml"];
NSURL *url1 = [NSURL URLWithString:@"http://search.twitter.com/search.json?q=mobtuts&rpp"];
for(int i = 0; i<=1; i++)
{
if(i==0)
{
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
NSString *str =[NSString stringWithFormat: @"%d", i];
request.userInfo = [NSDictionary dictionaryWithObject:str forKey:@"requestnum"];
[request setDelegate:self];
[networkQueue addOperation:request];
}
if(i==1)
{
ASIHTTPRequest *request1 = [ASIHTTPRequest requestWithURL:url1];
NSString *str =[NSString stringWithFormat: @"%d", i];
request1.userInfo = [NSDictionary dictionaryWithObject:str forKey:@"requestnum1"];
[request1 setDelegate:self];
[networkQueue addOperation:request1];
}
[networkQueue go];
}
}
는 requestFinished : (ASIHTTPRequest *) 요청 메도, 항상 responce로 첫 번째 XML 데이터 표시 (NSLog ("%의 @", responseString) @를) , requestnum에서 내 key를 requestnum1로 변경하면 responseString으로 첫 xml 데이터를 얻습니다. 두 번째 요청의 응답에 액세스 할 수없는 이유는 무엇입니까?
-(void)requestFinished:(ASIHTTPRequest *)request
{
NSString *str ;
str= [request.userInfo objectForKey:@"requestnum1"];
NSString *responseString = [request responseString];
str = [request responseString];
NSLog(@"%@",responseString);
}
@all 도와주세요! –
내 대답을 확인하십시오. –