有关ASINetworkQueues的问题

根据这个链接里的例子  https://gist.github.com/150447

- (void)doNetworkOperations
{
        // Stop anything already in the queue before removing it
        [[self networkQueue] cancelAllOperations];

        // Creating a new queue each time we use it means we don't have to worry about clearing delegates or resetting progress tracking
        [self setNetworkQueue:[ASINetworkQueue queue]];
        [[self networkQueue] setDelegate:self];
        [[self networkQueue] setRequestDidFinishSelector:@selector(requestFinished:)];
        [[self networkQueue] setRequestDidFailSelector:@selector(requestFailed:)];
        [[self networkQueue] setQueueDidFinishSelector:@selector(queueFinished:)];

        int i;
        for (i=0; i<5; i++) {
                ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"http://allseeing-i.com"]];
                [[self networkQueue] addOperation:request];
        }

        [[self networkQueue] go];
}




- (void)requestFinished:(ASIHTTPRequest *)request
{
        // You could release the queue here if you wanted
        if ([[self networkQueue] requestsCount] == 0) {

                // Since this is a retained property, setting it to nil will release it
                // This is the safest way to handle releasing things - most of the time you only ever need to release in your accessors
                // And if you an Objective-C 2.0 property for the queue (as in this example) the accessor is generated automatically for you
                [self setNetworkQueue:nil];
        }

        //... Handle success
        NSLog(@"Request finished");
}


我在for循环里添加不了各不相同的请求, 因为要对各个请求返回的数据进行操作,在requestFinished方法里该怎么去区分事件呢?


    // Custom user information associated with the request (not sent to the server)
    NSDictionary *userInfo;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值