Hi,
i'm trying to delete credentials info on logout of app, according to apple docs the method: - removeCredential:forProtectionSpace:options should be used when "trying to delete a credential that has the
NSURLCredentialPersistenceSynchronizable
policy".My method is as follows:
NSDictionary *credentialsDict = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials];
if ([credentialsDict count] > 0) {
NSEnumerator *protectionSpaceEnumerator = [credentialsDict keyEnumerator];
id urlProtectionSpace;
while (urlProtectionSpace = [protectionSpaceEnumerator nextObject]) {
NSEnumerator *userNameEnumerator = [[credentialsDict objectForKey:urlProtectionSpace] keyEnumerator];
id userName;
while (userName = [userNameEnumerator nextObject]) {
NSURLCredential *cred = [[credentialsDict objectForKey:urlProtectionSpace] objectForKey:userName];
NSLog(@"cred to be removed: %@", cred);
NSDictionary * optionsDict = [[NSDictionary alloc] initWithObjectsAndKeys:@YES, NSURLCredentialStorageRemoveSynchronizableCredentials, nil];
[[NSURLCredentialStorage sharedCredentialStorage] removeCredential:cred forProtectionSpace:urlProtectionSpace options:optionsDict];
}
}
}
I just can't seem to remove the info.