title: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9860)
body: <p>I am getting the error: NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9860)</p>
  
  <p>The same code is working fine in IPhone 8 with os version 11.3.1 but in IPhone 6 with os version 12.2 it is not able to fetch the response.</p>
  
  <p>I am already having below in plist</p>
  
  <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
  &lt;dict&gt;
      &lt;key&gt;NSAllowsArbitraryLoads&lt;/key&gt;
      &lt;true/&gt;
  &lt;/dict&gt;
  </code></pre>
  
  <p>Complete log:</p>
  
  <blockquote>
    <p>2019-06-03 10:55:07.459917+0530 MyApp[12858:2218159] [BoringSSL] nw_protocol_boringssl_input_finished(1543) [C16.1:2][0x102f28c30] Peer disconnected during the middle of a handshake. Sending errSSLClosedNoNotify(-9816) alert
    2019-06-03 10:55:07.461886+0530 MyApp[12858:2218159] [BoringSSL] nw_protocol_boringssl_input_finished(1543) [C15.1:2][0x102f9a330] Peer disconnected during the middle of a handshake. Sending errSSLClosedNoNotify(-9816) alert
    2019-06-03 10:55:07.463252+0530 MyApp[12858:2218159] TIC TCP Conn Failed [16:0x28048db00]: 3:-9816 Err(-9816)
    2019-06-03 10:55:07.466969+0530 MyApp[12858:2218159] TIC TCP Conn Failed [15:0x28048e280]: 3:-9816 Err(-9816)
    2019-06-03 10:55:08.087508+0530 MyApp[12858:2218068] [BoringSSL] boringssl_context_alert_callback_handler(3724) [C17.1:2][0x102d7d020] Alert level: fatal, description: inappropriate fallback
    2019-06-03 10:55:08.088580+0530 MyApp[12858:2218068] [BoringSSL] boringssl_session_errorlog(224) [C17.1:2][0x102d7d020] [boringssl_session_handshake_incomplete] SSL_ERROR_SSL(1): operation failed within the library
    2019-06-03 10:55:08.089000+0530 MyApp[12858:2218068] [BoringSSL] boringssl_session_handshake_error_print(205) [C17.1:2][0x102d7d020] 4345208920:error:1000043e:SSL routines:OPENSSL_internal:TLSV1_ALERT_INAPPROPRIATE_FALLBACK:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-109.250.2/ssl/tls_record.cc:586:SSL alert number 86
    2019-06-03 10:55:08.089466+0530 MyApp[12858:2218068] [BoringSSL] boringssl_context_get_error_code(3617) [C17.1:2][0x102d7d020] SSL_AD_INAPPROPRIATE_FALLBACK
    2019-06-03 10:55:08.090298+0530 MyApp[12858:2218068] [BoringSSL] boringssl_context_alert_callback_handler(3724) [C18.1:2][0x102fed0f0] Alert level: fatal, description: inappropriate fallback
    2019-06-03 10:55:08.090387+0530 MyApp[12858:2218068] [BoringSSL] boringssl_session_errorlog(224) [C18.1:2][0x102fed0f0] [boringssl_session_handshake_incomplete] SSL_ERROR_SSL(1): operation failed within the library
    2019-06-03 10:55:08.090448+0530 MyApp[12858:2218068] [BoringSSL] boringssl_session_handshake_error_print(205) [C18.1:2][0x102fed0f0] 4345208920:error:1000043e:SSL routines:OPENSSL_internal:TLSV1_ALERT_INAPPROPRIATE_FALLBACK:/BuildRoot/Library/Caches/com.apple.xbs/Sources/boringssl/boringssl-109.250.2/ssl/tls_record.cc:586:SSL alert number 86
    2019-06-03 10:55:08.090479+0530 MyApp[12858:2218068] [BoringSSL] boringssl_context_get_error_code(3617) [C18.1:2][0x102fed0f0] SSL_AD_INAPPROPRIATE_FALLBACK
    2019-06-03 10:55:08.093938+0530 MyApp[12858:2218068] TIC TCP Conn Failed [17:0x280497000]: 3:-9860 Err(-9860)
    2019-06-03 10:55:08.095442+0530 MyApp[12858:2218068] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9860)
    2019-06-03 10:55:08.095507+0530 MyApp[12858:2218068] Task &lt;06FCD0BC-4B03-45CC-B67D-02578B332F5A>.&lt;1> HTTP load failed (error code: -1200 [3:-9860])
    2019-06-03 10:55:08.096102+0530 MyApp[12858:2218068] TIC TCP Conn Failed [18:0x280495bc0]: 3:-9860 Err(-9860)
    2019-06-03 10:55:08.097280+0530 MyApp[12858:2218068] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9860)</p>
  </blockquote>
  
  <p>TCP connection failure is something to do with handshake failure, but I can not get the reason of handshake failure..</p>
  
  <p>code : </p>
  
  <pre><code>    +(void) fetchAndStoreAppConfig :(NSDictionary *)configuration mudulesToUpdate:(NSArray *)listItems withUser:(NSString *)email trigger:(NSString *)trigger {
      dispatch_queue_t SDKDataFetchQueue = dispatch_queue_create("SDKData Fetch Queue",NULL);
          dispatch_async(SDKDataFetchQueue, ^{
  
              NSMutableURLRequest *request = [APICommunication getRequest:configuration mudulesToUpdate:listItems withUser:email trigger:trigger];
              NSDictionary *jsonValues = [SdkUtil getResponseFromApi:request];
              NSLog(@"API response %@",jsonValues);
              });
      }
  
      +(NSMutableURLRequest * _Nullable) getRequest :(NSDictionary * _Nullable)config mudulesToUpdate:(NSArray * _Nullable)listItems withUser:(NSString * _Nullable)email trigger:(NSString * _Nullable)trigger{
          NSError *err;
          NSData *convertedData = [NSJSONSerialization dataWithJSONObject:listItems options:0 error:&amp;err];
          NSString* entitiesStr = [[NSString alloc] initWithData:convertedData encoding:NSUTF8StringEncoding];
          NSString *entitiesStrtoURL = [entitiesStr stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
  
          NSString *completeURLStr = [NSString stringWithFormat:[self getBaseFormate],[NSString stringWithFormat:@"%@",config[CONFIG_BASE_URL]],@"v4/sdk?",[NSString stringWithFormat:@"%@",config[CONFIG_APP_ID]],entitiesStrtoURL, email, trigger];
          NSLog(@"SDK API: %@",completeURLStr);
          return [self getGetRequest:config url:completeURLStr];
      }
  
  +(NSMutableURLRequest*)getGetRequest:(NSDictionary *)config url:(NSString *)completeURLStr{
      NSURL *url = [NSURL URLWithString:completeURLStr];
      NSString *authStr = [self getAuthString:config];
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
      [request setURL:url];
      [request setHTTPMethod:@"GET"];
      [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
      [request addValue:authStr forHTTPHeaderField:@"authorization"];
      return request;
  }
  
      +(NSDictionary *)getResponseFromApi:(NSMutableURLRequest *)request{
          __block BOOL done = NO;
          __block NSDictionary * jsonValues;
          NSLog(@"sdk getResponseFromApi: %@",request);
          NSURLSessionDataTask *dataTask = [[APICommunication getSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
              if(data){
                  NSError *errShow;
                  jsonValues = [NSJSONSerialization JSONObjectWithData:data options:0 error:&amp;errShow];
                  NSLog(@"sdk JSon Description jsonvalues :%@",jsonValues.description);
                  if(errShow == nil){
                      NSLog(@"sdk Error: %@",error);
                      done = YES;
                  }
              }
              else{
                  NSLog(@"sdk Error description :%@",error.debugDescription);
                  [[NSNotificationCenter defaultCenter] postNotificationName:@"ErrorResponse" object:nil userInfo:nil];
              }
          }];
  
          [dataTask resume];
  
          while (!done) {
              NSDate *date = [[NSDate alloc] initWithTimeIntervalSinceNow:0.1];
              [[NSRunLoop currentRunLoop] runUntilDate:date];
          }
          return jsonValues;
      }
  </code></pre>