前几天我发现了ASIHTTPRequest,现在我被阻塞了。 我想通过https地址验证我的自我(https://user:[email protected]/0.1/userCom/?apikey=12432)ASIHTTPRequest身份验证
我试试这个代码:
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 {}";
有想法解决这个问题吗? 非常感谢!
i)这不是我的服务器,所以我会检查这与我的客户端:) 如果我尝试https:// user:[email protected]/0.1/userCom/?apikey = 12432对我Safari Mac没有问题。 ii)运作良好! 感谢您的帮助。如果你有任何其他的东西要添加,请写下:) – Pierre 2010-08-07 11:50:00
这可能是你的Mac有一些证书颁发机构提出的iphone没有,并且缺少证书颁发机构可能导致这种错误。如果你在设备上的safari上出现类似的错误,那么这就是问题 - 如果设备上的safari工作正常,那么它可能是某种asihttprequest错误。 – JosephH 2010-08-07 12:49:37
在大多数情况下禁用证书检查帮助 – knuku 2010-11-23 15:01:25