我正在尝试覆盖 AFHTTPClient 中的 -HTTPRequestOperationWithRequest:success:failure: 方法,如以下代码所示:
-(AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)urlRequest success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
AFHTTPRequestOperation *requestOperation = [super HTTPRequestOperationWithRequest:urlRequest success:success failure:failure];
[requestOperation setWillSendRequestForAuthenticationChallengeBlock:^(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge) {
}];
return requestOperation;
}
当我尝试编译它时,虽然我收到以下错误:
'AFHTTPRequestOperation' 没有可见的@interface 声明选择器'setWillSendRequestForAuthenticationChallengeBlock:'
setWillSendRequestForAuthenticationChallengeBlock: 方法在 AFURLConnectionOperation 中定义,但 AFHTTPRequestOperation 是一个子类,因此该方法也应该在 AFHTTPRequestOperation 中可用。
我没有太多的objective-c经验,所以也许我在做一些愚蠢的事情,但我找不到编译错误的原因。