Configuring Cocoapods with an existing static library and iOS application

后端 未结 2 1201
梦谈多话
梦谈多话 2020-12-12 16:48

I\'m having trouble getting my workspace to compile correctly with Cocoapods. There are 3 projects in the workspace, each with their own target:

  1. libPods - Coco
2条回答
  •  南笙
    南笙 (楼主)
    2020-12-12 17:28

    CocoaPods creates an implicit root target which by default links with the first target of the project. As you are creating another target and the link_with option is not inherited by children target definitions your set up is not working. In order to make the link_with option you can move it inside the block of the MyApp target definition.

    As the Common target links with the Pods, if you link those with the MyApp it will result in the duplicate symbols error as the app links with Common. In this case you just need to make the headers available to the MyApp target. This is simple to do but there isn't a proper DSL yet so for the moment is a bit hacky as a solution (but supported).

    workspace 'MyApp.xcworkspace'
    platform :ios, '5.0'
    
    target 'Common' do
      pod 'AFNetworking',               '1.1.0'
      pod 'TTTAttributedLabel',         '1.6.0'
      pod 'JSONKit',                    '1.5pre'
      pod 'Reachability',               '3.1.0'
    
      target 'MyApp', :exclusive => true do
        xcodeproj 'MyApp.xcodeproj'
      end
    end
    

提交回复
热议问题