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 WatchKit extension project.
The WatchKit extension project doesn't need a lot of frameworks I use in my normal target, but I can't get Cocoapods to work correct after altering my Podfile.
I use use_frameworks!
in my Podfile, but after running pod install
I get the following messages:
[!] 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.
I didn't change any settings for my the base configurations, but 2 of my 3 targets have the right Pods.debug
or Pods.release
set. The one without base configuration is the WatchKit App.
My original Podfile
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: '[email protected]:xmartlabs/XLForm.git'
pod 'Classy', git: '[email protected]: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
My altered Podfile
This is where I want to exclude certain pods from my WatchKit project.
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: '[email protected]:xmartlabs/XLForm.git'
pod 'UAProgressView'
pod 'Classy', git: '[email protected]: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
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: '[email protected]:xmartlabs/XLForm.git'
pod 'UAProgressView'
pod 'Classy', git: '[email protected]: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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With