我正在尝试在 IOS 中运行以下代码。
AFHTTPRequestOperation *requestOperation = [self.httpClient HTTPRequestOperationWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url.text]]
success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"reply data = %@", [[NSString alloc] initWithData:operation.responseData encoding:NSUTF8StringEncoding]);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"%@", error);
}];
[requestOperation setAuthenticationAgainstProtectionSpaceBlock:^BOOL(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace) {
return YES;
}];
然后我收到这样的错误:
-[AFHTTPRequestOperation setAuthenticationAgainstProtectionSpaceBlock:]:无法识别的选择器发送到实例 0x75a81f0
据我所知,我传递的块具有正确的返回类型和参数。我在这里做错了什么?