我们的 iPhone 模拟器存在问题,这是由使用此行引起的:
Foo = [NSURLCredential CredentialWithUser:foo
password:bar persistance:NSURLCredentialPersistencePermanent];
当证书被授予挑战时,问题就出现了
-(NSURLConnection *)connection
didReceiveAuthenticationChallenge(NSURLAuthenticationChallenge *)challenge
{
[[challenge sender]useCredential:Foo forAuthenticationChallenge:challenge]
}
所以现在当我们运行应用程序时,我们再也不会遇到身份验证挑战了,这很奇怪,即使我们将凭证更改为
Foo = [NSURLCredential CredentialWithUser:foo
password:bar persistance:NSURLCredentialPersistenceForSession];
or even
Foo = [NSURLCredential CredentialWithUser:foo
password:bar persistance:NSURLCredentialPersistenceNone];
总结一下:
通过使用 credentialpersistencepermanent,凭证以某种方式保存在某个地方,并自动用于访问我们需要对自己进行身份验证的任何地方。
因此,出于测试目的,我们真的很想删除这个持久的……凭证。
有什么想法吗?:)