ios - Swift 3 - 使用 API 调用的最新方法

标签 ios api swift3

<分区>


想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它.

关闭 5 年前

使用 swift 3 在 iOS 应用中管理 API 调用的最新方法是什么?

是NSURLSession吗?还是有另一种更新的方法?

最佳答案

在 swift 3 中 NS 前缀被移除,现在以下是 urlsession 的语法

URLSession.shared.dataTask(with: url!) { (data, response, error) in
         //do the work
}

关于ios - Swift 3 - 使用 API 调用的最新方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45341110/

上一篇:python - Objective-C 中常用的数组选项

下一篇:ios - 获取字符串中最后一个字符类型之后的文本

相关文章:

c# - net::ERR_NAME_NOT_RESOLVED docker

ios - Firebase 循环多级节点

swift - 参数标签 '(contentsOfFile:)' 与任何可用的重载都不匹配

ios - UIAlertController 实用程序类无法调用 UITextField 委托(delegate)或目标,但可以在 UIViewController 中工作

ios - "Call can throw, but it is not marked with ' 通过将我的项目转换为 swift 2 来尝试 ' and the error is not handled"

ios - 从 Firebase 打印所有子列 - iOS Swift 4

php - cj.com API 调用中的内容编码错误

iOS7 导航栏+状态栏文字颜色

ios - UITraitCollection getter,iOS13 不支持

javascript - 如何保护仅从前端使用的 API(Ajax 调用)