ios - '结果类型的值' 没有成员 '错误' [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>'
任何快速修复!
解决方案
改变
Result
至
Alamofire.Result
或者创建一个typealias
,
typealias AFResult = Alamofire.Result
并更改Result
为AFResult
.
推荐阅读
- javascript - 更模块化的 D3.js 编码
- python - writer.writerow() 没有在 for 循环内工作以写入所有特定数据
- python - 如何防止在 Python 代码中使用特定的 GPU
- r - 如何根据因素创建多路表?
- c++ - 矢量迭代器循环使用 g++ 而不是 VisualC++,为什么?
- jwt - 为什么在过滤器中使用 UserDetailsService?智威汤逊
- angular - 下拉列表未显示在数据库中的 html 上
- javascript - 返回一个由另一个数组中的迭代值填充的 N 个元素的新数组的简洁方法?香草 JavaScript
- aws-lambda - 如何减小 lambda 的大小(以减少冷启动时间)>> 我们可以使用层吗?
- java - 如何在 Spring Boot 中模拟 ApplicationContext.getAutowireCapableBeanFactory