Include pods in main target and not in WatchKit extension

前端 未结 1 1152
鱼传尺愫
鱼传尺愫 2021-02-06 04:58

I added a WatchKit extension to my current project. The project uses Cocoapods 0.36.1 to add some frameworks, but now I want to exclude some pods from the Watch

1条回答
  •  臣服心动
    2021-02-06 05:30

    The warnings outputted by CocoaPods is due to two CocoaPods targets are trying to be linked to a single target in your application (which isn't supported).

    I.e, you have an explicit target HomeHandler and you are linking the nameless target to HomeHandler too with link_with "HomeHandler", "HomeHandler WatchKit Extension".

    My suggestion would be to revamp your Podfile to look something like the following:

    platform :ios, '8.0'
    use_frameworks!
    
    source 'https://github.com/artsy/Specs.git'
    source 'https://github.com/CocoaPods/Specs.git'
    
    def shared_pods
        pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
        pod 'CocoaLumberjack', '~> 2.0.0'
        pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"
        pod 'UICKeyChainStore'
    end
    
    target 'HomeHandler' do
        shared_pods
        pod 'XLForm', git: 'git@github.com:xmartlabs/XLForm.git'
        pod 'UAProgressView'
        pod 'Classy', git: 'git@github.com:depl0y/Classy.git'
        pod 'Reveal-iOS-SDK', :configurations => ['Debug']
        pod 'JBChartView', '~> 2.8.9'
        pod 'RFQuiltLayout'
        pod 'HUMSlider', '~> 1.0'
        pod 'SwiftEventBus', :git => 'https://github.com/depl0y/SwiftEventBus.git'
        pod 'PureLayout'
    end
    
    target 'HomeHandler WatchKit Extension' do
        shared_pods
    end
    

    0 讨论(0)
提交回复
热议问题