Предупреждение XCode: несколько целей соответствуют неявной зависимости для продукта - PullRequest
2 голосов
/ 16 октября 2019

У меня есть приложение, которое поставляется в двух вариантах (платное и бесплатное). Одна из моих платформ называется AppBootstrap, которая имеет две подспецификации (FreeVersion и PaidVersion)

Теперь XCode продолжает выдавать это надоедливое предупреждение (я стремлюсь к нулевым предупреждениям в моем проекте, поэтому я не хочу просто игнорировать его, скользконаклон и все в таком духе;))

Multiple targets match implicit dependency for product reference 'AppBootstrap.framework'. Consider adding an explicit dependency on the intended target to resolve this ambiguity. (in target 'The Flight Tracker Free' from project 'The Flight Tracker')
Target 'AppBootstrap-FreeVersion' (in project 'AppBootstrap')
Target 'AppBootstrap-PaidVersion' (in project 'AppBootstrap')

Я немного погуглил, но не смог найти, как это решить. Я пытался * добавить его на этапе сборки 'Link Binary With Libraries', но это не помогло. * добавив его в фазу зависимостей, но они там не отображаются. * изменив '-framework AppBootstrap' в 'Параметры сборки => Другие флаги компоновщика' на '-framework AppBootstrap-FreeVersion', но это просто приводит к ошибкам.

Мой подфайл (упрощенный)

source 'custom-pods/link'
source 'https://cdn.cocoapods.org/'

platform :ios, '9.0'

install! 'cocoapods',
  :generate_multiple_pod_projects => true,
  :incremental_installation => true

use_frameworks!
inhibit_all_warnings!

workspace 'MyApp'

target 'MyAppFree' do
  pod 'AppBootstrap/FreeVersion'
end

target 'MyAppPaid' do    
  pod 'AppBootstrap/PaidVersion'
end

AppBootstrap podspec

Pod::Spec.new do |s|
    s.name        = 'AppBootstrap'
    s.version     = '3.18.2'
    s.summary     = 'iOS App Bootstrap Module.'
    s.platforms   = { ios: '9.0' }
    s.swift_version = '5.0'

    s.description = <<-DESC
        Contains classes to bootstrap ios apps.
    DESC

    s.homepage = ---
    s.license  = { type: 'MIT', file: 'LICENSE' }
    s.author   = { --- }
    s.source   = { --- }

    s.frameworks = [
        'Foundation',
        'UIKit'
    ]


    s.subspec 'PaidVersion' do |sub|
        sub.dependency 'Advertisement/Core'

        sub.source_files = [
            'AppBootstrap/source/**/*.swift'
        ]

        sub.resources = [
            'AppBootstrap/support/Localization/*.lproj',
            'AppBootstrap/support/ConsentText.plist',
            'AppBootstrap/support/Images.xcassets'
        ]

        sub.pod_target_xcconfig = {
            'APPLICATION_EXTENSION_API_ONLY' => 'NO'
        }

        sub.pod_target_xcconfig = {
            'OTHER_SWIFT_FLAGS' => '-D"PAIDVERSION"'
        }
    end

    s.subspec 'FreeVersion' do |sub|
        sub.dependency 'Advertisement/Ads'

        sub.source_files = [
            'AppBootstrap/source/**/*.swift'
        ]

        sub.resources = [
            'AppBootstrap/support/Localization/*.lproj',
            'AppBootstrap/support/ConsentText.plist',
            'AppBootstrap/support/Images.xcassets',
            'AppBootstrap/support/Colors.xcassets',
            'AppBootstrap/support/Fonts/*.otf'
        ]

        sub.pod_target_xcconfig = {
            'APPLICATION_EXTENSION_API_ONLY' => 'NO'
        }

        sub.pod_target_xcconfig = {
            'OTHER_SWIFT_FLAGS' => '-D"FREEVERSION"'
        }
    end

    s.subspec 'Undefined' do |sub|
        sub.dependency 'Advertisement/Core'

        sub.source_files = [
            'AppBootstrap/source/**/*.swift'
        ]

        sub.resources = [
            'AppBootstrap/support/Localization/*.lproj',
            'AppBootstrap/support/ConsentText.plist',
            'AppBootstrap/support/Images.xcassets',
            'AppBootstrap/support/Fonts/*.otf'
        ]

        sub.pod_target_xcconfig = {
            'APPLICATION_EXTENSION_API_ONLY' => 'NO'
        }

        sub.pod_target_xcconfig = {
            'OTHER_SWIFT_FLAGS' => '-D"UNDEFINEDVERSION"'
        }
    end

    s.default_subspec = 'Undefined'
end

Любая помощь / совет с благодарностью =)

1 Ответ

0 голосов
/ 08 ноября 2019

ошибка только что произошла в Pruduct -> Архив.

вы можете установить модуль для одной цели перед архивом.

source 'custom-pods/link'
source 'https://cdn.cocoapods.org/'

platform :ios, '9.0'

install! 'cocoapods',
  :generate_multiple_pod_projects => true,
  :incremental_installation => true

use_frameworks!
inhibit_all_warnings!

def MyAppPods (scheme)
  if scheme == 'MyAppFree'
    pod 'AppBootstrap/FreeVersion'
  end
  if scheme == 'MyAppPaid'
    pod 'AppBootstrap/PaidVersion'
  end
end

workspace 'MyApp'

scheme = ENV['scheme']
if scheme
  target scheme do
    MyAppPods scheme
  end
else
  target 'MyAppFree' do
    MyAppPods 'MyAppFree'
  end

  target 'MyAppPaid' do    
    MyAppPods 'MyAppPaid'
  end
end
scheme='MyAppFree' pod install
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...