14
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS S3 へアップロードした画像とAlamofireImage の相性問題

Posted at

現象

Image の読み込みが必ず失敗する

原因

  1. AWS S3 へ画像をアップロードする際に ContentType を何も設定しないと、S3 はそれを「binary/octet-stream」と認識する。(自動で判別してくれたりはしない)
  2. AlamofireImage (というか Alamofire) には ContentType の Validation があり、許可リストの中に binary/octet-stream は含まれない。

対処法

プログラムのどこかで

Alamofire.Request.addAcceptableImageContentTypes(["binary/octet-stream"])

と記述する。以上。

14
11
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
14
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?