ios - 快速的 Alamofire 4.0

标签 ios swift migration alamofire

 Alamofire.request(TWConstants.LoginUrl,
                          method: .post,
                          parameters: param as! [String : String],
                          encoding: JSONEncoding.default,
                          headers: TWNetworkManager.getHeaderUser(username, passwd: passwd) as? [String : String]).responseJSON

这是我的发帖请求。错误如下:

Extra argument 'method' in call

我正在将我的 Alamofire 版本 3 迁移到 Alamofire 版本 4。我试图查看文档但没有任何帮助。有人可以帮助我吗?

最佳答案

Swift 4 , 使用这个

params = [
           "username" : "",
           "password" : "" ]

Alamofire.request(url, method: .post, parameters: params, encoding: URLEncoding.default, headers: nil).responseJSON { (response) in
            print(response.result.value)
}

关于ios - 快速的 Alamofire 4.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53470991/

相关文章:

ios - Apple 框架 ISA 分类

ios - iPhone X 上未收到 Firebase 通知 FCM

ios - 知道 Realm Collection Change 通知中对象的哪个元素发生了变化?

javascript - 我们应该将 jQuery 与 AngularJS 一起使用吗?

security - 您将如何将盐添加到现有的密码哈希中?

ios - iOS Storyboard 中 View 的底部条在 iPad 上不显示

ios - 查看 EkReminder 重复频率的最佳方式?

ios - 显示游戏中心排行榜无法快速工作

postgresql - Informix SE 到 PostgreSQL 数据迁移

ios - Xamarin.Forms iOS Simulator Build for Facebook Review