当我尝试调用自己拥有的自定义API(使用Alamofire)时,出现以下错误提示
let API_URL = "https://localhost:5001/api"
func registerNewUser(parameters: Parameters) {
let urlString = API_URL + "/register/PostTest"
let url = URL.init(string: urlString)
print("URL: \(url!)")
Alamofire.request(url!, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: nil).debugLog().responseJSON{ //--> point of failure
response in
if response.result.isSuccess {
print("Success! the request to the API is successful")
let userJson : JSON = JSON(response.result.value!)
print(userJson)
} else {
print("Error \(response.result.error!)")
}
}
}
info.plist file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>https://localhost</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Include to allow HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Include to specify minimum TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
错误是:
CredStore-performQuery-复制匹配的凭据时出错。错误= -25300,查询= { 类= inet; “ m_Limit” =“ m_LimitAll”; ptcl = htps; “ r_Attributes” = 1; sdmn =本地主机; srvr =本地主机; sync = syna; }