LoginSignup
3
3

More than 1 year has passed since last update.

【Swift】Alamofire6でresponseJSONが使えなくなるらしい

Posted at

警告文が突然出現

'responseJSON(queue:dataPreprocessor:emptyResponseCodes:emptyRequestMethods:options:completionHandler:)' is deprecated: responseJSON deprecated and will be removed in Alamofire 6. Use responseDecodable instead.

responseJSONは非推奨です。
Alamofire 6で削除される予定です。
代わりにresponseDecodableを使ってください。

だそうです。

気づいた時に修正しておくのが一番ということで修正したので共有します。

結論

- AF.request("", method: .get).responseJSON
+ AF.request("", method: .get).responseData

警告文にはresponseDecodableと記載してあったがresponseDataの方が綺麗に置き換えができた。

おわり

今回の記事を書くにあたって使ったテスト的なプロジェクトがあるのでサンプルとして置いておきます。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3