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];
posted on 2017-06-14 14:07  blfbuaa  阅读(297)  评论(0)    收藏  举报