首页 > 解决方案 > '结果类型的值' 没有成员 '错误' [Alamofire, Swift 5]

问题描述

由于 Swift 5 引入了Result类型,所以我在使用 Alamofire 时遇到了很多错误。

其他错误:

Enum case 'success' has no associated values
Member 'failure' in 'Result<T>' produces result of type 'Result<String>', but context expects 'Result<T>'

任何快速修复!

标签: iosswiftalamofireswift5

解决方案


改变

Result

Alamofire.Result

或者创建一个typealias

typealias AFResult = Alamofire.Result

并更改ResultAFResult.


推荐阅读