I have this code:
func loginWithBasicAuth() -> Void {
let usernameText = username.text
let passwordText = password.text
let credentialData = "\(usernameText):\(passwordText)".dataUsingEncoding(NSUTF8StringEncoding)
let base64Credentials = credentialData?.base64EncodedStringWithOptions([])
let headers = ["Authorization": "HTTP Basic \(base64Credentials)"]
Alamofire.request(.GET, "https://api.domainname.com/v0.1/", headers: headers).responseString { aResponse in
if let receivedString = aResponse.result.value {
print(receivedString)
} else {
print("Login failed.")
}
}
}
In the console it prints:
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802) Login failed.
Here's the configuration in the info.plist
file:
What's wrong?
NSTemporaryExceptionRequiresForwardSecrecy = NO
in your exception domain – Warren BurtonNSIncludesSubdomains
to api.domainname.com dictionary.And set it to YES to include subdomains – LeoException Domains
format? – Bright Futurehttps
,it seems that it is not the problem of App Transport Security. Does your api server have valid Certificate? – Leo