Alamofire / AlamofireImage

AlamofireImage is an image component library for Alamofire
MIT License
3.99k stars 523 forks source link

Crashing when using af_setImage() in ImageDownloader #337

Closed Vincent-Loi closed 6 years ago

Vincent-Loi commented 6 years ago

What did you do?

Load a remote url with imageView.af_setImage(withURL: imageUrl as URL, imageTransition: .crossDissolve(0.1))

What did you expect to happen?

Load the image successfully.

(Works in previous versions)

What happened instead?

Crashed at the following lines:

SessionManager.png

ImageDownloader.png

Alamofire Environment

Alamofire version: 4.8.0 AlamofireImage version: 3.4.1 Xcode version: 10.1 (10B61) Swift version: 4.2 Platform(s) running AlamofireImage: iOS macOS version running Xcode: 10.14

npjk commented 6 years ago

Hello,

I have the exact same issue with the exact same environment. If it can help, when the crash occurs, this appears in the logs :

dyld: lazy symbol binding failed: Symbol not found: _$S9Alamofire14SessionManagerC13configuration8delegate017serverTrustPolicyC0ACSo25NSURLSessionConfigurationC_AA0B8DelegateCAA06ServerghC0CSgtcfcfA0_
  Referenced from: /PATH_TO_APP/Frameworks/AlamofireImage.framework/AlamofireImage
  Expected in: /PATH_TO_APP/Frameworks/Alamofire.framework/Alamofire

dyld: Symbol not found: _$S9Alamofire14SessionManagerC13configuration8delegate017serverTrustPolicyC0ACSo25NSURLSessionConfigurationC_AA0B8DelegateCAA06ServerghC0CSgtcfcfA0_
  Referenced from: /PATH_TO_APP/Frameworks/AlamofireImage.framework/AlamofireImage
  Expected in: /PATH_TO_APP/Frameworks/Alamofire.framework/Alamofire
jshier commented 6 years ago

How are you both integrating Alamofire? If you're using Carthage or some other prebuilt source, you may want to rebuild all of your dependencies so they link properly.

npjk commented 6 years ago

In my case yes: I'm using Carthage for this project. I tried to clean everything up and rebuild. Once at the latest version 3.4.1 and again using 3.4.0 but got the same issue.

But just a minute ago I went checking another project where I'm using AlamofireImage (and where I don't have this issue). I tried the versions used there and the issue is gone. So, the only difference is Alamofire which is at version 4.7.3 (while AlamofireImage is at 3.4.1).

jshier commented 6 years ago

A clean project rebuild may not rebuild Carthage dependencies. For that you need to use Carthage directly.

jshier commented 6 years ago

I can reproduce this in a fresh project. Strange that it says there's an issue with the initializer, but nothing about the init changed, just an additional defaulted parameter for the multipart upload. Strange.

jshier commented 6 years ago

Building with CocoaPods doesn't show this issue.

jshier commented 6 years ago

@Vincent-Loi @nicolas255 I have a branch up that fixes this: update-for-alamofire-4.8. You can use the following in your Cartfile to use it until we have time to do an official release.

github "Alamofire/AlamofireImage" "update-for-alamofire-4.8"
jshier commented 6 years ago

3.5 has been released which should fix this issue.