From 33539a3c9c8534776722aa1148499f984e0019e7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 2 Oct 2019 13:59:51 +0300 Subject: Move loginSegue to Tab bar controller --- Juick/APIClient.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Juick/APIClient.m') 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]; + } } -- cgit v1.2.3