从我的应用程序中删除帐户时,我正在尝试从存储中删除凭据。这是我正在使用的代码:
NSDictionary *dict = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials];
NSDictionary *dictCopy = [dict copy];
for(NSURLProtectionSpace *key in [dictCopy keyEnumerator])
{
NSDictionary *value = [dict objectForKey:key];
NSURLCredential *cred = [value objectForKey:accountLogin];
if(cred)
[[NSURLCredentialStorage sharedCredentialStorage] removeCredential:cred forProtectionSpace:key];
}
NSLog(@"%@",[[NSURLCredentialStorage sharedCredentialStorage] allCredentials]);
为所有正确的键和值调用删除部分,但在方法完成后,所有凭据仍然完好无损。这怎么可能?
我也尝试过设置新凭据,但似乎它们也没有被识别