3

Here is my code and I have not used Borring SSL anywhere

NSURL* urlToRequest = [NSURL URLWithString:urlString];
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:urlToRequest];
[urlRequest setHTTPMethod:@"GET"];

NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession *session = [NSURLSession sessionWithConfiguration:config];

NSError *error = nil;

if (!error) {

    NSURLSessionDataTask *downloadTask = [session dataTaskWithRequest:urlRequest completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
        if (!error) {
            NSHTTPURLResponse *httpResp = (NSHTTPURLResponse*) response;
            if (httpResp.statusCode == 200) {
                NSString *response1=[[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
                NSLog(@"JSON:%@",response1);
                NSLog(@"Response:%@",response);
                NSLog(@"Error:%@",error);

            }
        }
    }];

    [downloadTask resume];

}

Here is the error that I get and I am wondering what causes the issue ?

[BoringSSL] Function boringssl_session_errorlog: line 2871 [boringssl_session_read] SSL_ERROR_ZERO_RETURN(6): operation failed because the connection was cleanly shut down with a close_notify alert

I am getting success response and after sometime I am getting this error.

As far as I understand its just a warning and I don't have to think about it.

Anyway I got successful response.Please correct me If I was wrong

Any suggestions are welcome

P.S When I copy paste the URL in browser I don't see any error as well

2
  • 1
    Did you ever figure this out? I've got a Swift 4, Xcode 9 project that's giving me this. Commented Jun 16, 2018 at 19:18
  • 1
    @Dale - I was keep on getting it.If you find the fix please do let me know Commented Jun 27, 2018 at 15:29

1 Answer 1

-1

Try with this

NSURL *url = [NSURL URLWithString:urlString];
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:url];
NSData *requestData = [prams dataUsingEncoding:NSUTF8StringEncoding];

[urlRequest setHTTPMethod:@“GET”];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

NSURLSessionDataTask * dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:urlRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
    //NSLog(@"data=%@",data);

    if (data.length>0 && error==nil) {
        NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:NULL];
        NSLog(@"Dict=%@",dict);


    }
}];
[dataTask resume];
Sign up to request clarification or add additional context in comments.

1 Comment

It didn't fix the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.