summaryrefslogtreecommitdiff
path: root/Juick/APIClient.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-02 13:59:51 +0300
committerGravatar Vitaly Takmazov2019-10-02 13:59:51 +0300
commit33539a3c9c8534776722aa1148499f984e0019e7 (patch)
tree6f47880a9efd4e6e240ff55c043422f68dba6936 /Juick/APIClient.m
parentd9a6f5e85d9cffed7e8bf84b6e69b27d7db67582 (diff)
Move loginSegue to Tab bar controller
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];
+ }
}