几天前我发现了ASIHTTPRequest,现在我被阻止了。我想在 https 地址上验证自己的身份(https://user:pwd@api.domain.com/0.1/userCom/?apikey=12432)
我试试这段代码:
NSURL *url = [NSURL URLWithString:@"https://api.domain.com/0.1/userCom/?apikey=12432"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setDelegate:self];
[request setUsername:@"myUserName"];
[request setPassword:@"myPassword"];
[request startAsynchronous];
我已经实现了委托方法
-(void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
NSLog(@"Failed %@ with code %d and with userInfo %@",[error domain],[error code],[error userInfo]);
}
-(void)requestFinished:(ASIHTTPRequest *)request
{
NSLog(@"Finished : %@",[request responseString]);
}
当我启动我的应用程序时,直接调用 requestFailed 方法,我收到以下消息:
Failed ASIHTTPRequestErrorDomain with code 1 and with userInfo {
NSLocalizedDescription = "A connection failure occurred: SSL problem (possibly a bad/expired/self-signed certificate)";
NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-9807 \"The operation couldn\U2019t be completed. (OSStatus error -9807.)\" UserInfo=0x680fbf0 {}";
有解决这个问题的想法吗?非常感谢 !