Skip to content

Instantly share code, notes, and snippets.

@laiso
Last active December 21, 2015 13:59
Show Gist options
  • Save laiso/6316956 to your computer and use it in GitHub Desktop.
Save laiso/6316956 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface NSURLCredentialStorage (Reset)
- (void)removeAllCredentials;
@end
#import "NSURLCredentialStorage+Reset.h"
@implementation NSURLCredentialStorage (Reset)
- (void)removeAllCredentials
{
NSDictionary* credentials = [self allCredentials];
for (NSURLProtectionSpace* space in credentials) {
for (NSURLCredential* cred in [[credentials objectForKey:space] objectEnumerator]) {
[self removeCredential:cred forProtectionSpace:space];
}
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment