8

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

gpichler
  • 2,181
  • 2
  • 27
  • 52
  • Cocoapod and Carthage are 2 different things, when you use Cocoapod you don't need to add framework file to your project explicitly, If you add it using Carthage then you need to add .Framework file to your Project's `Link Binary With Libraries` section not inside Pod. – Dipen Panchasara Aug 23 '16 at 12:14
  • I explicitly want to add the framework, as I want to reduce compile time in my main project. However my own framework is integrated as a private pod, but my private pod uses other frameworks like Moya, which are integrated as framework. (Please see step 2) – gpichler Aug 23 '16 at 12:17
  • Though you need to add it into your Project not inside Pod project. Move it inside your project from Pod project. – Dipen Panchasara Aug 23 '16 at 12:18
  • @DipenPanchasara unfortunately adding it to Link Binary with Libraries (containing Moya.framework and Pods.framework) in the main project did not help, still the same issue. – gpichler Aug 23 '16 at 12:25
  • Remove it from `Podfile` and Pod project. Only keep it in Project's `Link Binary with Libraries`. Don't keep it in both the places. – Dipen Panchasara Aug 23 '16 at 12:29
  • I don't have Moya in Podfile, it's integrated via Carthage. I need Moya in my private pod and in my main project. When just using Cocoapods I can use a dependency of a pod in my main project as well, however this seems to be impossible with Carthage. – gpichler Aug 23 '16 at 12:31
  • why do you need it in both the places? Use any one at a time 1)Add manually in your main project, 2) Add using Cocoapods or 3) Add using Carthage. – Dipen Panchasara Aug 23 '16 at 12:32
  • I'm sorry if I didn't explain it good enough. SwiftModel (private pod) is a standalone framework and can be used in other projects too (needs Moya via Carthage to reduce compile time), main project needs SwiftModel (as Cocoapod) and Moya (should use Moya from SwiftModel. – gpichler Aug 23 '16 at 12:43

1 Answers1

2

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

pkc456
  • 8,350
  • 38
  • 53
  • 109
  • Unfortunately it's not possible to remove the arm64 architecture of my main project. Also it would be surprising if Moya does not support arm64. – gpichler Aug 31 '16 at 07:42
  • Have you tried other options which I wrote in bullet format. – pkc456 Aug 31 '16 at 07:43
  • Yes, unfortunately the error still occurs. I'm not sure if it's possible at all with Cocoapods (vendored frameworks). – gpichler Sep 01 '16 at 08:21
  • I just found the similar issue on [official moya github](https://github.com/Moya/Moya/issues/445). (Something about `carthage update --platform iOS --no-use-binaries` and deleting a folder.) – pkc456 Sep 01 '16 at 08:26