From bf573afb9d05ce34ecd22b3dca85aca2c3896ae6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 2 Oct 2019 17:16:01 +0300 Subject: Shared navigation --- Juick/APIClient.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Juick/APIClient.m') diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 848ea77..c7e22cf 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -175,10 +175,12 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler { if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodHTTPBasic) { - completionHandler(NSURLSessionAuthChallengeUseCredential, self.credential); - } else { - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); + if (self.isAuthenticated) { + completionHandler(NSURLSessionAuthChallengeUseCredential, self.credential); + return; + } } + completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); } -(void) fetchDataWithURL:(NSURL *) url data:(NSData *)postData boundary:(NSString *)boundary callback:(void(^)(NSData *, NSError *))callback { -- cgit v1.2.3