Search code examples
swiftalamofirecarthagealamofireimage

Carthage Symbol not found when try Alamofire


I am trying Carthage and I thought raywenderlich blog post is awesome to start. So I download the starter project, then set my Carthage settings, I dragged then dropped my Alamofire.framework & AlamofireImage.framework files to Frameworks, Libraries and Embedded Content. Then I add run script which is /usr/local/bin/carthage copy-frameworks, after that add input files as paths of the frameworks.

$(SRCROOT)/Carthage/Build/iOS/Alamofire.framework
$(SRCROOT)/Carthage/Build/iOS/AlamofireImage.framework

And when I clean & run the project it stuct at

dyld: Symbol not found: _$s9Alamofire14SessionManagerCN
  Referenced from: /Users/fiyuu/Library/Developer/CoreSimulator/Devices/E42E9DED-5A99-44C8-A0EB-0FF765CB8FB3/data/Containers/Bundle/Application/C102F9B5-402A-40F3-A450-B0D420A7722D/DuckDuckDefine.app/Frameworks/AlamofireImage.framework/AlamofireImage
  Expected in: /Users/fiyuu/Library/Developer/CoreSimulator/Devices/E42E9DED-5A99-44C8-A0EB-0FF765CB8FB3/data/Containers/Bundle/Application/C102F9B5-402A-40F3-A450-B0D420A7722D/DuckDuckDefine.app/Frameworks/Alamofire.framework/Alamofire
 in /Users/fiyuu/Library/Developer/CoreSimulator/Devices/E42E9DED-5A99-44C8-A0EB-0FF765CB8FB3/data/Containers/Bundle/Application/C102F9B5-402A-40F3-A450-B0D420A7722D/DuckDuckDefine.app/Frameworks/AlamofireImage.framework/AlamofireImage

Even I do not import and no-use Alamofire, it fails.

Then I try to solve this problem via other questions and in this link, it thought Foundation.framework must be added. So I tried it but there's no effect for the problem.

Xcode Version: Version 11.0 (11A420a)

So do you have any idea about the problem? Maybe I must add extra flag for build or something? And Referenced from library and Expected in seems the installation is not successful, is it possible to solve with re-building the frameworks?

Thanks


Solution

  • I solved my question with using Alamofire dependency without specify any target or version in Cartfile.

    The error occurs from the github "Alamofire/Alamofire" "5.0.0-rc.2" line, in new Alamofire you can use it with AF.request(...) and this version not successfully generate framework for me.

    So I change the line with just github "Alamofire/Alamofire" then updated my Carthage, so it work well for me.