AlamofireImage: af_setImage on ios13 causes app to crash

Hi also have the same problem. the af_setImage cause my app to crash. in xcode 10 it worked fine. version from the store works great on ios13. in xcode11 (official) it crashes. (phone and simulator). if i run earlier simulators (ios10,11) the code works. the debugger points on UIImage+AlamofireImage.swift extension UIImage

public static func af_threadSafeImage(with data: Data, scale: CGFloat) -> UIImage? {
   lock.lock()
   let image = UIImage(data: data, scale: scale) //the debugger stops here
   lock.unlock()
   return image
}

and in the console i see seek:285: *** IIOScanner::seek reached EOF getVal16:139: *** IIOScanner::getVal16 reached EOF

Alamofire Environment

Alamofire version: 4.9.0 AlamofireImage version: 3.5.2 Xcode version: 11 Swift version: 4.2 Platform(s) running AlamofireImage: iphone ios13 macOS version running Xcode: 10.14.6

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

Seems like on the version that I am is 3.5 and the code is:

“DataRequest.addAcceptableImageContentTypes([“application/octet-stream”])”.

And now works as expected … Thank you for your help !! Hope somehow is added in there for the next version.

Which is the latest version by the way ?

This has been resolved by adding "application/octet-stream" as an acceptable content type in f48f8cfe. This change will go out shortly in AFI 4.0.0.

Cheers. 🍻

Ah, as others have found, adding ImageResponseSerializer.addAcceptableImageContentTypes(["application/octet-stream"]) before loading images should accept these images that don’t have a specific MIME type set. application/octet-stream sniffing was removed in iOS 13, so perhaps that’s affect AFI’s loading of images. Odd, if so. We may be able to add it as an acceptable content type.