AFNetworking 取消请求

取消单个操作:

AFHTTPRequestOperation *operation
     = [[AFHTTPRequestOperation alloc] initWithRequest:request];

[operation cancel];

或者

AFHTTPRequestOperation *operation 
    = [postManager POST:request.methodUrl
             parameters:parameters
                success:^(AFHTTPRequestOperation *operation,
                          id responseObject) {
                          }failure:^(AFHTTPRequestOperation *operation,
                              NSError *error){
        }];

[operation cancel];

取消所有操作:

AFHTTPRequestOperationManager *httpmanager 
    = [AFHTTPRequestOperationManager manager];

[httpManager.operationQueue cancelAllOperations];

版权声明:本文为博主原创文章,未经博主允许不得转载。

文章来自:http://blog.csdn.net/a12a33/article/details/47418467
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3