summaryrefslogtreecommitdiff
path: root/Juick/APIClient.m
diff options
context:
space:
mode:
Diffstat (limited to 'Juick/APIClient.m')
-rw-r--r--Juick/APIClient.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/Juick/APIClient.m b/Juick/APIClient.m
index 4652c0c..848ea77 100644
--- a/Juick/APIClient.m
+++ b/Juick/APIClient.m
@@ -19,6 +19,8 @@
@implementation APIClient
+@synthesize credential = _credential;
+
+(APIClient *) sharedClient {
static APIClient *sharedAPIClient = nil;
static dispatch_once_t onceToken;
@@ -157,7 +159,12 @@
}
- (void)setCredential:(NSURLCredential *)credential {
- [[NSURLCredentialStorage sharedCredentialStorage] setCredential:credential forProtectionSpace:self.apiProtectionSpace];
+ if (credential) {
+ [[NSURLCredentialStorage sharedCredentialStorage] removeCredential:_credential forProtectionSpace:self.apiProtectionSpace];
+ [[NSURLCredentialStorage sharedCredentialStorage] setCredential:credential forProtectionSpace:self.apiProtectionSpace];
+ } else {
+ [[NSURLCredentialStorage sharedCredentialStorage] removeCredential:_credential forProtectionSpace:self.apiProtectionSpace];
+ }
}