简体   繁体   English

如何在 Alamofire 中使用“responseDecodable”方法?

[英]How to use "responseDecodable" method in Alamofire?

I have been trying to use "responseDecodable" method from Alamofire, but I'm getting "Generic parameter 'T' could not be inferred" error while using it.我一直在尝试使用来自 Alamofire 的“responseDecodable”方法,但是在使用它时出现“无法推断通用参数‘T’”错误。 阿拉莫菲尔

Can someone guide me how to fix this?有人可以指导我如何解决这个问题吗?

As you can read in the documentation , using responseDecodable is straightforward:正如您在文档中所读到的,使用responseDecodable很简单:

AF.request(...).responseDecodable(of: ResponseType.self) { response in 
    ...
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM