Search code examples
swiftcocoapodscarthagemoya

Static framework linked to Cocoapod not found in Main project


I'm trying to add a static framework (Moya) to my private Cocoapod project through Carthage.

My goal is to include Moya as a static framework in my private Cocoapod (SwiftModel) and use Moya as well in my main project (as SwiftModel has a dependency to it).

I've added Moya to my framework by doing the following steps:

  1. link framework in podspec file

    s.vendored_frameworks = 'SwiftModel/Carthage/Build/iOS/Moya.framework'

  2. add Moya to private framework (Link Binary With Libraries)

enter image description here

So inside my Pods project it looks like this:

enter image description here

Trying to add the path to "Framework Header Search Path" did not made any changes. I've tried to add it in the main project and in pods project.

When just building the private pod everything works fine and Moya is recognized. However if I want to build the main project (that includes my private pod) I'm always getting this error:

framework not found Moya for architecture arm64

enter image description here


Solution

  • As your error states that

    framework not found Moya for architecture arm64

    It means that Moya is not available for arm64 architecture, but your main project has following architectures;- arm64, armv7, armv7s. Remove the arm64 from your main project's valid architecture.

    • Also try to add -Objc in other link flags.
    • Try adding libz to the link library section of you project

    iOS Support matrix:-

    enter image description here