最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

ios - Multiple targets match implicit dependency for linker flags '-framework DynamicColor' - Stack Overflow

programmeradmin5浏览0评论

I have a project, and podfile like this

source '.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.

I have a project, and podfile like this

source 'https://github/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.

Share Improve this question edited Feb 17 at 19:16 HangarRash 15.1k5 gold badges19 silver badges55 bronze badges asked Feb 17 at 10:14 Rising SunRising Sun 1 New contributor Rising Sun is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Add a comment  | 

1 Answer 1

Reset to default 0

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/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
发布评论

评论列表(0)

  1. 暂无评论