每次收到https请求的响应后,我都需要删除NSURLCredential存储。这在我的情况下是不会发生的。下面的方法只在第一次请求时执行,对于下一次请求则不会调用。当我重新启动应用程序时,它会被调用。我尝试了很多建议,但都没有用。我该如何解决这个问题呢?
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
SecTrustRef trust = challenge.protectionSpace.serverTrust;
NSURLCredential *cred;
cred = [NSURLCredential credentialForTrust:trust];
[challenge.sender useCredential:cred forAuthenticationChallenge:challenge];
}发布于 2015-09-16 15:17:41
将凭据的persistence属性设置为NSURLCredentialPersistenceNone。这将确保凭证永远不会被存储以供将来使用(假设您不是在为iOS 2构建)。
https://stackoverflow.com/questions/23994877
复制相似问题