我正在使用以下代码进行请求:
func getManager() -> SessionManager
{
let newManager : Alamofire.SessionManager = {
// Create the server trust policies
let serverTrustPolicies: [String: ServerTrustPolicy] = [
"106.51.77.46.xip.io:3487": .disableEvaluation
]
// Create custom manager
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = Alamofire.SessionManager.defaultHTTPHeaders
let manager = Alamofire.SessionManager(
configuration: URLSessionConfiguration.default,
serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
)
return manager
}()
return newManager
}
AAmanager = getManager()
以这种方式提出请求:
AAmanager.request(requestAddress , method: .post, parameters: body, encoding: JSONEncoding.default, headers: header).responseJSON { response in
// utility
}
// url i am using is "https://106.51.77.46.xip.io:3487/session"
我明白了:
TIC SSL Trust Error [1:0x60800016c540]: 3:0
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)
Task <0ED64C32-72D9-4428-A275-15C590EBAC21>.<1> HTTP load failed (error code: -1200 [3:-9802])
Task <0ED64C32-72D9-4428-A275-15C590EBAC21>.<1> finished with error - code: -1200
但是我无法连接(我得到的状态码为nil)。不仅我无法调用https URL,而且也无法以这种方式调用任何http url。
这可能是什么问题,我该如何纠正?
我正在使用Swift 4和Xcode 9
有人请在这里帮助