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