diff options
author | Vitaly Takmazov | 2020-05-15 00:30:28 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2020-05-15 00:30:28 +0300 |
commit | fa1bf7a6c04cea5df8b68f49bbf69cd1c9a4d235 (patch) | |
tree | ff48a51dba1ecca73291bda3408ba524df2bdeaa /Juick | |
parent | a0b21b2f7992687b107d5583acd42ce088b49e45 (diff) |
Cleanup unused synchronized credentials
Diffstat (limited to 'Juick')
-rw-r--r-- | Juick/AppDelegate.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m index 47c18ef..441240a 100644 --- a/Juick/AppDelegate.m +++ b/Juick/AppDelegate.m @@ -26,6 +26,20 @@ NSString * const UserUpdatedNotificationName = @"UserUpdated"; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // cleanup synchronized credentials which are not used anymore + NSDictionary *dict = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials]; + NSDictionary *dictCopy = [dict copy]; + for(NSURLProtectionSpace *key in [dictCopy keyEnumerator]) + { + if ([key.host isEqual:@"api.juick.com"]) { + NSDictionary *value = [dict objectForKey:key]; + NSArray *creds = [value allValues]; + for (NSURLCredential *cred in creds) { + [[NSURLCredentialStorage sharedCredentialStorage] removeCredential:cred forProtectionSpace:key options:@{ + NSURLCredentialStorageRemoveSynchronizableCredentials:@YES}]; + } + } + } self.api = [API new]; self.sharedDateFormatter = [NSDateFormatter new]; self.sharedDateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss"; |