Error loading XX Server and NSAppTransportSecurity

I am using OS X Server 4.1.3 and iPhone 6 with iOS9 beta.

When I try to connect to OS X Server ("skw.local") with

let urlPath: String = "https://skw.local/"
let url: NSURL = NSURL(string: urlPath)!
let request: NSMutableURLRequest = NSMutableURLRequest(URL: url)
let sessionConfig = NSURLSessionConfiguration.defaultSessionConfiguration()
let sesh = NSURLSession(configuration: sessionConfig)
let task = sesh.dataTaskWithRequest(request) {(data, response, error) -> Void in
     if error == nil {
          print("Response: \(response)")
     }
     else {
          print(error, appendNewline: true)
     }
}
task.resume()

      

I am getting the following error:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
You might be connecting to a server that is pretending to be "skw.local" which could put your confidential information at risk."

      

I've tried to work around the NSAppTransportSecurity requirements by adding the following to my Info.plist:

<key>NSAppTransportSecurity</key>
<dict>
     <key>NSAllowsArbitraryLoads</key><true/>
</dict>

      

but I am getting the same errors.

Does anyone else have similar issues?

edit: I also posted this on the apple dev forum

+3


source to share





All Articles