作者fightword (呼啦啦~)
看板MacDev
标题请问ASIHTTPRequet支援digest authentication吗
时间Fri Oct 26 17:13:46 2012
用代码如下:
ASIHTTPRequest *requestASI = [[[ASIHTTPRequest alloc] initWithURL:urlFromString] autorelease];
requestASI.shouldPresentCredentialsBeforeChallenge = YES;
[requestASI setValidatesSecureCertificate:YES];
[requestASI setUsername:authMD];
[requestASI setPassword:authPassword];
[requestASI setAuthenticationScheme:(NSString *)kCFHTTPAuthenticationSchemeDigest];
[requestASI addRequestHeader:@"Accept" value:@"application/json;charset=UTF-8"];
[requestASI addRequestHeader:@"Accept-Encoding" value:@"gzip,deflate"];
[requestASI setShouldAttemptPersistentConnection:YES];
[requestASI setDelegate:self];
[requestASI setDidFinishSelector:@selector(ResquestFinished:)];
[requestASI setDidFailSelector:@selector(ResquestFailed:)];
[requestASI startAsynchronous];
可是总是第1次回传Authentication needed
但连续发送2次就能成功Authentication needed
可不可以设定参数後在第1次就发送成功,有人作过吗? 谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.25.148.86
※ 编辑: fightword 来自: 114.25.148.86 (10/26 17:17)
1F:推 johnlinvc:ASI已经停止开发了,建议改用AFNetworking||RestKit 10/26 20:19
2F:→ osnq:听起来怎麽好像是成功是第一次的response... 10/26 22:32
3F:推 Boska:AFN好物 10/28 02:22