So I am new to iOS development and have been going the Swift route rather than Objective C admittedly because I know nothing about Objective C. I ran into the classic bad certificate problem as described here:

NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813) iOS

but I do not understand how to actually implement the accepted answer there in my Swift project.

I understand the string check to whatever domain I want to allow through, but have no idea where this code is supposed to go.

Here is the swift code I am currently using to make the request:

var request = NSMutableURLRequest(URL: self.url!);
request.HTTPMethod = requestType.toRaw();

let task = NSURLSession.sharedSession().dataTaskWithURL(self.url!) {(data: NSData!, response: NSURLResponse!, error: NSError!) in
    println(NSString(data: data, encoding: NSUTF8StringEncoding));
};
task.resume();

Related posts

Recent Viewed