我们的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,凭据以某种方式保存在某个地方,并自动用于访问我们需要进行身份验证的任何地方。
所以为了测试的目的,我们真的想删除这个持久的...凭据。
有没有人有主意?:)
发布于 2011-06-04 23:42:41
你有没有试过重置模拟器?它在模拟器菜单中。
发布于 2013-07-25 16:06:59
它被保存在钥匙链中。要从NSURLCredentialPersistencePermanent转到像NSURLCredentialPersistenceForSession这样的非永久性状态,您必须删除它并重新创建它。
请注意,在某些版本的工具中,重置模拟器不会清除密钥链。
https://stackoverflow.com/questions/6226439
复制相似问题