Static library and cocoapods with Xcode 6.1.1

Not sure it is related to Xcode 6.1.1 or Cocoapods 0.35.0.

I have generated new static iOS library with Xcode 6.1.1.

SUCCESS (without cocoapods)

  • Generate simulator and Device library
  • Lipo to both and generate FAT MyLib.a static final lib
  • Create new View Application project. (I haven't changed any default setting. eg Base SDK, Valid Architecture.)
  • Add MyLib.a and necessary header files to application project manually.
  • Build the app project and IT WORKS FINE !! NO ERROR NO WARNING.
  • ERROR

  • Upload same MyLib.a & headers (generated above) to HTTP direct download server(kind of artifact server).
  • Generate specs & podfile.
  • Remove all dependency (lib and header) from app project which i have done manually earlier.
  • Add pod file and local specs
  • "Pod install" command pull out MyLib.a and header properly in /Pods folder.
  • But while building the app project gives me

       Ld Build/Products/Debug-iphonesimulator/LibTest.app/LibTest normal x86_64
        cd /Users/admin/Cocoapods/Project/Library/TestProject/LibTest
        export IPHONEOS_DEPLOYMENT_TARGET=8.1
    
     ld: library not found for -lMyLib
     clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    When i fire "lipo" command on MyLib.a

    Architectures in the fat file: /Users/admin/Cocoapods/Project/Library/Libs/Final/MyLib.a are: armv7 armv7s i386 x86_64 arm64

    Its not really architecture issue otherwise it should get failed in my first attempt which doesn't have cocoapods. Cocoapods does some build configuration changes and that creates this issue.

    Help me to resolve this issue.


    After spending 2 days to figure out the exact issue, i found very silly fix. Its basically issue with static library naming convention issue. If you have static library in artifact/media http server and wanted to integrate with Cococapods, make sure library name should be lib(your name).a along with headers.

    In my case i have kept MyLib and it got dowloaded currently while "pod install" but during app building it was failing. After renaming to libMyLib.a , every thing works for me. :)

    Very easy to apply yet difficult to find such solution]

    Not sure whether cocoapods has documented this in there any guide or not.

    链接地址: http://www.djcxy.com/p/67120.html

    上一篇: 如何使用Bitcode启用xcodebuild静态库?

    下一篇: 使用Xcode 6.1.1的静态库和cocoapods