Cocoapods将同一个Pod安装到多个目标(带有UITest目标的问题)

Woj*_*icz 5 xcode ios cocoapods xcode-ui-testing

我使用此示例为不同的目标安装相同的Pod

从此示例博客文章引用:

http://natashatherobot.com/cocoapods-installing-same-pod-multiple-targets/

# Podfile

platform :ios, '8.0'
source 'https://github.com/CocoaPods/Specs.git'

link_with ['YourProject']

workspace 'YourProject.xcworkspace'
xcodeproj 'YourProject.xcodeproj'

def shared_pods

    #shared pods

end

def testing_pods

    #shared testing pods

end

target 'YourProject' do
    shared_pods
end

target 'YourProjectTests' do
    shared_pods
    testing_pods
end

target 'YourProjectUITests' do
    shared_pods
    testing_pods
end
Run Code Online (Sandbox Code Playgroud)

但是我最终在YourProjectUITests目标中链接了问题:

Undefined symbols for architecture x86_64:

  "_OBJC_CLASS_$_GAI", referenced from:
      objc-class-ref in Utility.o
  "_OBJC_CLASS_$_GAIDictionaryBuilder", referenced from:
      objc-class-ref in HomeViewController.o

  "_OBJC_CLASS_$_NewRelicAgent", referenced from:
      objc-class-ref in AppDelegate.o
  "_kGAIHitType", referenced from:
Run Code Online (Sandbox Code Playgroud)

使用可可豆荚0.39.0&Xcode 7.2

我将尝试删除pod.lock并重新安装pod ..

当我在pod配置中删除UITestTarget时,我不再有任何冲突