Ios 将POD包括在主目标中,而不包括在WatchKit扩展中

Ios 将POD包括在主目标中,而不包括在WatchKit扩展中,ios,swift,cocoapods,Ios,Swift,Cocoapods,我在当前项目中添加了一个WatchKit扩展。该项目使用Cocoapods0.36.1来添加一些框架,但现在我想从WatchKit扩展项目中排除一些pod WatchKit扩展项目不需要在我的普通目标中使用很多框架,但是在修改了我的pod文件之后,我无法让cocoapod正常工作 我使用使用框架在我的pod文件中,但在运行pod install后,我收到以下消息: [!] CocoaPods did not set the base configuration of your project b

我在当前项目中添加了一个WatchKit扩展。该项目使用Cocoapods0.36.1来添加一些框架,但现在我想从WatchKit扩展项目中排除一些pod

WatchKit扩展项目不需要在我的普通目标中使用很多框架,但是在修改了我的pod文件之后,我无法让cocoapod正常工作

我使用
使用框架
在我的pod文件中,但在运行
pod install
后,我收到以下消息:

[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler` to `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.debug.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.debug.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler` to `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.release.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler/Pods-HomeHandler.release.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler WatchKit Extension` to `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.debug.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.debug.xcconfig` in your build configuration.
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target `HomeHandler WatchKit Extension` to `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.release.xcconfig` or include the `Pods/Target Support Files/Pods-HomeHandler WatchKit Extension/Pods-HomeHandler WatchKit Extension.release.xcconfig` in your build configuration.
我没有更改基本配置的任何设置,但我的3个目标中有2个具有正确的
Pods.debug
Pods.release
设置。没有基本配置的是WatchKit应用程序

我的原始播客文件

platform :ios, '8.0'
use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
pod 'CocoaLumberjack', '~> 2.0.0'
pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"
pod 'PureLayout'
pod 'UAProgressView'
pod 'UICKeyChainStore'
pod 'XLForm', git: 'git@github.com:xmartlabs/XLForm.git'
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/cesarferreira/SwiftEventBus.git'

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == "Pods-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
        if target.name == "Pods-PureLayout"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'PURELAYOUT_APP_EXTENSIONS=1']
            end
        end
    end
end
我修改过的播客文件

platform :ios, '8.0'
use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

pod 'AFNetworking', :git => 'https://github.com/AFNetworking/AFNetworking.git'
pod 'CocoaLumberjack', '~> 2.0.0'
pod 'MagicalRecord', :git => "https://github.com/magicalpanda/MagicalRecord.git"
pod 'PureLayout'
pod 'UAProgressView'
pod 'UICKeyChainStore'
pod 'XLForm', git: 'git@github.com:xmartlabs/XLForm.git'
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/cesarferreira/SwiftEventBus.git'

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == "Pods-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
        if target.name == "Pods-PureLayout"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'PURELAYOUT_APP_EXTENSIONS=1']
            end
        end
    end
end
这就是我想从WatchKit项目中排除某些POD的地方

platform :ios, '8.0'

use_frameworks!

source 'https://github.com/artsy/Specs.git'
source 'https://github.com/CocoaPods/Specs.git'

link_with "HomeHandler", "HomeHandler WatchKit Extension"

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'

target :HomeHandler do
    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

post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.name == "Pods-AFNetworking"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
        if target.name == "Pods-PureLayout"
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'PURELAYOUT_APP_EXTENSIONS=1']
            end
        end
    end
end

CocoaPods输出的警告是由于两个CocoaPods目标正试图链接到应用程序中的单个目标(不受支持)

也就是说,你有一个明确的目标
HomeHandler
,你也在用
link\u和“HomeHandler”,“HomeHandler WatchKit Extension”
将无名目标链接到HomeHandler

我的建议是修改您的播客文件,使其看起来如下所示:

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

我收到以下错误:找不到-lPods-Project\u name WatchKit扩展的库。我的pod文件是:#取消对此行的注释以定义项目的全局平台#平台:ios,“8.0”#如果使用Swift,请取消对此行的注释#使用#框架!平台:ios,:deployment_target=>“7.0”target'Project_name',:exclusive=>true do pod'Google/Analytics'end target'Project_name WatchKit Extension'do pod'Google/Analytics'end@kylefts在xcode 8下对我不起作用。它安装得很好,没有问题,但是当我编译项目时,有数千个错误与应用程序扩展中包含的pod有关,即使它们没有包含在扩展的
目标do end
块中。