diff options
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"; |