I\'m using Xcode 7, Swift 2, and iOS9. I want to connect to a web service using NSURLSession but I get the following error when I try to connect:
2015-10-13
Take a look at this article.Shipping an App With App Transport Security particularly the sections about self-signed certificates.
You'll most likely need the delegate method of the form,
func URLSession(session: NSURLSession, didReceiveChallenge challenge: NSURLAuthenticationChallenge, completionHandler: (NSURLSessionAuthChallengeDisposition, NSURLCredential?) -> Void) {
completionHandler(
.UseCredential,
NSURLCredential(trust: challenge.protectionSpace.serverTrust!)
)
}
Adding this to my own comms class that uses NSURLSession fixed the issue.