Visa Developer Community

Regular Visitor

iOS: Connection error

Hello,

 

I initiate a request to the Visa Offers Platform with the following code:

 

        NSError *error;
        NSData *postData = [NSJSONSerialization dataWithJSONObject:requestDataDictionary
                                                           options:0
                                                             error:&error];
        if (error) {
            NSException* jsonSerializationException = [NSException
                                                       exceptionWithName:@"JSONSerializationException"
                                                       reason:@"JSON Serialization Failed"
                                                       userInfo:nil];
            @throw jsonSerializationException;
        }
        
        [request setHTTPBody:postData];
        
        NSURLSessionDataTask *postDataTask = [session dataTaskWithRequest:request
                                                        completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
                                                            NSLog(@"Response:%@", response);
                                            }];
        [postDataTask resume];

I get this error. Any idea what goes wrong ?

 

Screenshot 2019-04-09 at 11.37.59.png

1 REPLY 1
Highlighted
Visa Dev Moderator

Re: iOS: Connection error

Hi,

 

From the logs, it seems like you are getting SSL handshake exception. It may be due to certificates not being passed along with the request. Please refer to the below blog for recommended architecture and plan to connect using a server layer.

 

https://community.developer.visa.com/t5/Developer-Tools/Recommended-Architecture-for-Building-Applic...

 

Thanks,

Jai