Reputation: 1
I have a project, and podfile like this
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
inhibit_all_warnings!
def commandPod
pod 'DynamicColor'
end
target 'MyApp' do
platform :ios, '13.0'
commandPod
pod 'JXPagingView/Paging'
pod 'JXSegmentedView'
pod 'LookinServer', :subspecs => ['Swift'], :configurations => ['Debug']
end
target 'MyAppWidgetExtension' do
platform :ios, '14.0'
commandPod
pod 'AttributedText', :path => '../AttributedText'
end
touch_ios_14 = ['AttributedText']
post_install do |installer|
installer.pods_project.targets.each do |target|
puts "[post_install] target #{target}"
target.build_configurations.each do |config|
if touch_ios_14.include?(target.name)
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
else
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
end
then i run pod install
, i got those message:
Multiple targets match implicit dependency for linker flags '-framework
DynamicColor'. Consider adding an explicit dependency on the
intended target to resolve this ambiguity.
Target'DynamicColor-iOS13.0'(in project 'Pods')
Target 'DynamicColor-iOS14.0' (in project 'Pods')
so my question is:
my MyApp
supports 13.0 or above, but MyAppWidgetExtension
project supports 14.0 or above, both of which require DynamicColor
or other.
Upvotes: 0
Views: 32
Reputation: 337
As the error states, you should Consider adding an explicit dependency on the intended target to resolve this ambiguity.
Try changing your pod file to
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
inhibit_all_warnings!
def commandPod(target)
target.dependency 'DynamicColor'
end
target 'MyApp' do
platform :ios, '13.0'
commandPod(self)
pod 'JXPagingView/Paging'
pod 'JXSegmentedView'
pod 'LookinServer', :subspecs => ['Swift'], :configurations => ['Debug']
end
target 'MyAppWidgetExtension' do
platform :ios, '14.0'
commandPod(self)
pod 'AttributedText', :path => '../AttributedText'
end
touch_ios_14 = ['AttributedText']
post_install do |installer|
installer.pods_project.targets.each do |target|
puts "[post_install] target #{target}"
target.build_configurations.each do |config|
if touch_ios_14.include?(target.name)
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.0'
else
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
# Ensure explicit linking to avoid duplicate dependencies
installer.pods_project.targets.each do |target|
if target.name == 'DynamicColor'
target.build_configurations.each do |config|
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
end
end
end
end
And running
pod deintegrate
pod install --verbose
Upvotes: 0