Search code examples
iosframeworkscocoapodsstatic-librariesstatic-framework

cocoad pods - build static framework


Hi have this cocoapod framework, which I distribute in binary mode only (no sources). Basically, I am distributing the output of carthage build, which creates a dynamic framework.

I have been asked to release a static version of this framework as well. I have made a new target in XCode which builds the framework using a static library (using same sources as the dynamic framework).

Eventually, I file ...blabla.a and see it contains only arm architectures.

I have been looking into: https://github.com/Carthage/Carthage/blob/master/Documentation/StaticFrameworks.md - but this just fails for me (at linking state it tries to execute Ld which fails).

My code is only objc, and I am running Xcode 10.2.1.


Solution

  • Version v0.30 and above of Carthage can build static frameworks. Documentation does not say how :)

    The link provided above is useless (does not work on modern systems). Instead I used this: https://github.com/Carthage/Carthage/issues/2534#issuecomment-407807111 and got a static framework.

    As a bonus, I was able to make a new cocoapod (I added a new podfile, with same name and a static postfix), which links to my static build (in the same repo as the dynamic, just a different path), only diff between those two pods, is s.static_framework = true.

    I am unsure how to make this a single pod which will honour use_framworks!, this this method