gpt4 book ai didi

iphone - ASIHTTP请求-HTTPS

转载 作者:行者123 更新时间:2023-12-03 18:32:22 25 4
gpt4 key购买 nike

ASIHTTPRequest 支持 HTTPS 连接吗?我的连接现在适用于 HTTP 连接,如果我尝试 HTTPS 连接,则会出现错误。 (进入 requestFailed 并给我一个 ASIHTTPErrorRequestDomain)

-(void) getData
{

av.hidden = NO;
[av startAnimating];

NSString *urlString = [IP stringByAppendingString:@"Method1"];
NSURL *url = [NSURL URLWithString:urlString];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
NSLog(@"URL = %@",url);
[request setRequestMethod:@"POST"];
[request setPostValue:@"val1" forKey:@"key1"];
[request setPostValue:@"val2" forKey:@"key2"];
[request setDelegate:self];
[request startAsynchronous];
}

- (void)requestFinished:(ASIHTTPRequest *)request
{
// Use when fetching text data
//NSString *responseString = [request responseString];

// Use when fetching binary data
NSData *responseData = [request responseData];
[self parseData:responseData];

[av stopAnimating];
av.hidden = YES;
}


- (void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
[av stopAnimating];
av.hidden = YES;
}

谢谢,
泰贾

最佳答案

哎呀,抱歉,我明白了 -

[request setValidatesSecureCertificate:NO]可供引用。

感谢这些人 - http://www.iphonedevsdk.com/forum/iphone-sdk-development/29417-asihttprequest-library-works-https.html

编辑:由于这得到了一些支持,我想补充一点,这可能不是有效 SSL 证书的最佳方法。我使用的是自签名证书,所以这很好。

关于iphone - ASIHTTP请求-HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2730539/

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