summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2020-05-15 00:30:28 +0300
committerGravatar Vitaly Takmazov2020-05-15 00:30:28 +0300
commitfa1bf7a6c04cea5df8b68f49bbf69cd1c9a4d235 (patch)
treeff48a51dba1ecca73291bda3408ba524df2bdeaa /Juick
parenta0b21b2f7992687b107d5583acd42ce088b49e45 (diff)
Cleanup unused synchronized credentials
Diffstat (limited to 'Juick')
-rw-r--r--Juick/AppDelegate.m14
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";