在用ASIHTTPRequest的时候,如果设置了
[request setUseKeychainPersistence:YES];
那么你的证认信息将保存在keyChain里,即是是错误的认识也会保存,错误的其实不应该保存,于是我们得想办法将错误的从keyChain中清除掉,读了一下源码,找到了方法,直接上代码,只需要将下面代码
[ASIHTTPRequest removeCredentialsForProxy:[request proxyHost] port:[request proxyPort] realm:[request proxyAuthenticationRealm]]; NSDictionary *credentials = [request findSessionProxyAuthenticationCredentials]; [ASIHTTPRequest removeProxyAuthenticationCredentialsFromSessionStore:[credentials objectForKey:@"Credentials"]]; 加入到[request setFailedBlock:^{ }];中即可
这样,当错误的时候,就会将认识信息删除。