swiftalamofiretvosalamofireimage

Alamofire not recognizing Webp


Running on Apple TV I get the following error from Alamofire when trying to download a webp file:

Request failed due to an underlying Alamofire error: Response Content-Type "image/webp" does not match any acceptable types: image/gif,image/x-xbitmap,image/x-win-bitmap,application/octet-stream,image/jpg,image/ico,image/x-icon,image/x-bmp,image/x-ms-bmp,image/jpeg,image/heif,image/png,image/tiff,image/jp2,image/bmp,image/heic

Running the same under iOS, again with Alamofire, does not produce this result. Why is Alamofire, at least on Apple TV, not recognizing image/webp as a valid content-type?

Alamofire - 5.6.2 (SPM)
AlamofireImage - 4.2.0 (SPM)
tvOS 15.x 

This question was closed for not being relevant to programming. This is a Swift question related to Alamofire supporting the webp format on tvOS. The Apple documentation seems to suggest it is supported and I am sure other developers will come across the same situation using Apple Swift documentation that would lead them to believe webp is supported. This is highly relevant to any tvOS developer working with differing media content. I respectfully request it be reopened to help others in the future.


Solution

  • Unfortunately tvOS (and watchOS) do not support rendering WebP images, despite recognizing the file type. I don't know why Apple has arbitrarily limited support like this, but that's why AlamofireImage doesn't support it on tvOS.