Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ViewController: UIViewController {
- ...
- @IBAction func logon(_ sender: Any) {
- print("=== start ===");
- // Create the server trust policies
- let serverTrustPolicies: [String: ServerTrustPolicy] = [
- "127.0.0.1": .disableEvaluation
- ]
- let manager = Alamofire.SessionManager(
- configuration: URLSessionConfiguration.default,
- serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies)
- )
- let parameters : [String: Any] = ["login" : login!, "password" : pass!, "apiver": "0.14-dev"]
- let header: HTTPHeaders = ["Accept": "application/json"]
- let request = manager.request("https://127.0.0.1:9991/auth", method: .post, parameters: parameters, encoding: JSONEncoding(options: []),headers :header).responseJSON
- { response in
- asd(response)
- if let json = response.result.value {
- print("JSON: \(json)")
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement