gpt4 book ai didi

iOS AFNetworking 在何处放置 setWillSendRequestForAuthenticationChallengeBlock 操作

转载 作者:行者123 更新时间:2023-11-29 02:42:22 25 4
gpt4 key购买 nike

我正在使用 AFNetworking 2,如何设置 setWillSendRequestForAuthenticationChallengeBlock 以发送挑战证书?

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];

最佳答案

#define _AFNETWORKING_PIN_SSL_CERTIFICATES_

在我尝试调用setWillSendRequestForAuthenticationChallengeBlock的文件中:

我知道cocoapods已经在Pods-prefix.pch中做了#define,并且没想到应该再次定义它。

它可能对你有帮助..

关于iOS AFNetworking 在何处放置 setWillSendRequestForAuthenticationChallengeBlock 操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25599456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com