五、Swift Alamofire入门

前端之家收集整理的这篇文章主要介绍了五、Swift Alamofire入门前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装.

source 'https://github.com/CocoaPods/Specs.git'
platform :ios,'10.0'
use_frameworks!
target 'IOSStock' do
    pod 'Alamofire',:git => 'https://github.com/Alamofire/Alamofire.git'
end

2.使用

let parameters: Parameters = [
            "phone":account! as String,"password":password! as String
        ]
        Alamofire.request(URLS.LOGIN_URL,parameters: parameters).responseJSON { response in
            print("Response JSON: \(response.result.value)")
        }

3.打开app的网络访问(info.plist)

App Transport Security Settings
    Allow Arbitrary Loads:yes
原文链接:https://www.f2er.com/swift/322596.html

猜你在找的Swift相关文章