开发者

Can't remove NSURLCredentials from storage

I'm trying to remove credentials from storage when an account is deleted from my app. Here's the code I'm us开发者_运维百科ing:

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]);

The remove part gets called for all of the right keys and values but after the method completes, all of the credentials are still intact. How is that possible?

I've also tried setting new credentials but it seems like they aren't getting recognized either

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜