Search code examples
iosxcodedependenciescocoapodsstatic-libraries

CocoaPods: use static lib into a pod


I have a pod that depends on a static lib (precompiled, source code not available).

In this pod project, i drag and drop the folder containing the ".a" file and some other C, Obj-c files.

When i try to include this pod in an application, Cocoapods copy all that pod files but not the ".a" file.

In the Podspec, im using this to include the precompiled library to my pod

  s.ios.vendored_frameworks = 'path/a_staticLib.a'

The line above copy the file in frameworks (Pods folder), this is normal as it is called "vendored_frameworks", but i can't found any solution to work with static library.

the error i have :

ld: framework not found -framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thank you.


Solution

  • As said in CocoaPods Podspec documentation, you need to use vendored_libraries for static libraries.

    So this line:

    s.ios.vendored_frameworks = 'path/a_staticLib.a'
    

    should be:

    s.ios.vendored_libraries = 'path/a_staticLib.a'