取消单个操作:
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];
本文介绍如何使用AFNetworking库取消HTTP请求。包括取消单个操作的方法,通过直接调用operation的cancel方法实现;以及取消所有正在进行的操作,通过调用operationQueue的cancelAllOperations方法实现。

1098

被折叠的 条评论
为什么被折叠?



