iOS AFNetworking在何处放置setWillSendRequestForAuthenticationChallengeBlock on操作
im使用AFNetworking 2,如何设置setWillSendRequestForAuthenticationChallengeBlock以在质询时发送证书iOS AFNetworking在何处放置setWillSendRequestForAuthenticationChallengeBlock on操作,ios,afnetworking,Ios,Afnetworking,im使用AFNetworking 2,如何设置setWillSendRequestForAuthenticationChallengeBlock以在质询时发送证书 NSString *url = [NSString stringWithFormat:@"%@%@", API_URL_ROOTV1, API_URL_HUBA]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithStri
NSString *url = [NSString stringWithFormat:@"%@%@", API_URL_ROOTV1, API_URL_HUBA];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setWillSendRequestForAuthenticationChallengeBlock:^(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge) {
}];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
}];
[operation start];
在我试图调用setWillSendRequestForAuthenticationChallengeBlock
的文件中:
我知道cocoapods已经在Pods-prefix.pch中定义了#define,不希望再次定义它
它可能会帮助你
#define _AFNETWORKING_PIN_SSL_CERTIFICATES_