gpt4 book ai didi

ios - 更新到 xcode 8.1 后,Alamofire 库 request.swift 文件中出现错误 - "Ambiguous use of Task"

转载 作者:行者123 更新时间:2023-11-29 11:52:38 25 4
gpt4 key购买 nike

Ambiguous use of Task

在升级之前我已经将我的 Xcode 更新到 Xcode 8.1 它工作正常但是在升级之后我已经将 swift 2.3 转换为 swift 3.0 并添加了更新的 alamofire 库。但是它在 Alamofire 的 request.swift 文件中给出了错误。

最佳答案

我找到了。

请求.swift >>

    NotificationCenter.default.post(
//name: Notification.Name.Task.DidSuspend,
name: Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend"),
object: self,
//userInfo: [Notification.Keys.Tasks: task]
userInfo: ["org.alamofire.notification.key.task": task]
)

NotificationCenter.default.post(
//name: Notification.Name.Task.DidCancel,
name: Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel"),
object: self,
//userInfo: [Notification.Keys.Tasks: task]
userInfo: ["org.alamofire.notification.key.task": task]
)

session 委托(delegate).swift >>

        NotificationCenter.default.post(
//name: Notification.Name.Task.DidComplete,
name: Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete"),
object: strongSelf,
//userInfo: [Notification.Keys.Tasks: task]
userInfo: ["org.alamofire.notification.key.task": task]
)

编辑另一个相同的代码。可能有 4 ~ 5 个函数。

祝你好运

关于ios - 更新到 xcode 8.1 后,Alamofire 库 request.swift 文件中出现错误 - "Ambiguous use of Task",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40483990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com