------------https方式-----------------------swift
由于Swift9以后访问接口只能使用https,因此在后台加入pfx文件(怎么生成,自行百度吧)
1.将pfx放在项目根目录下面。
2.将Program的启动项改成api
<key>NSPrincipalClass</key>服务器
<string>NSApplication</string>闭包
<key>NSAppTransportSecurity</key>测试
<dict>字体
<key>NSAllowsArbitraryLoads</key>ui
<true/>spa
</dict>server
</dict>接口
</plist>
2.将.Net Core代码再改回去(若是你安装上面的方式修改的话)
Alamofire.request("http://localhost:5000/api/******/Gettables").responseJSON { response in
print(response.request) // 原始的URL请求
print(response.response) // HTTP URL响应
print(response.data) // 服务器返回的数据
print(response.result) // 响应序列化结果,在这个闭包里,存储的是JSON数据
if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}