OGeek|极客世界-中国程序员成长平台

标题: ios - Cocoapods 没有正确链接第三、第四个目标(Xcode 7 beta 6) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 16:12
标题: ios - Cocoapods 没有正确链接第三、第四个目标(Xcode 7 beta 6)

我在使用 Cocoapods 和 Xcode 7 beta 6 时遇到问题:我有一个包含三个不同测试目标(测试、UITests、IntegrationTests)的项目。我的 pod 似乎在第一个目标(“测试”)上工作得很好,但其他目标有问题:

附上显示链接器错误的屏幕截图。同样,只有在我尝试在后两个目标中使用 XCGLogger 时才会发生这种情况。它在第一个目标中运行良好。

Linker error on some targets

为了彻底……这是我正在使用的 Podfile:

platform :ios, "8.0"
use_frameworks!

target 'Glimpulse' do
  pod "SwiftSpinner", :git => 'https://github.com/zbeckman/SwiftSpinner.git'
  pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
  pod 'GRValidation', '~> 0.2'
end

target 'GlimpulseTests' do
  pod "SwiftSpinner", :git => 'https://github.com/zbeckman/SwiftSpinner.git'
  pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
  pod "Nimble", :git => 'https://github.com/Quick/Nimble.git', :branch => 'swift-2.0'
  pod "Quick", :git => 'https://github.com/zbeckman/Quick.git', :branch => 'swift-2.0'
  pod 'GRValidation', '~> 0.2'
#  pod "SwiftCheck", :git => 'https://github.com/zbeckman/SwiftCheck.git', :branch => 'swift-develop'
end

target 'GlimpulseUITests' do
  pod "SwiftSpinner", :git => 'https://github.com/zbeckman/SwiftSpinner.git'
  pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
  pod "Nimble", :git => 'https://github.com/Quick/Nimble.git', :branch => 'swift-2.0'
  pod "Quick", :git => 'https://github.com/zbeckman/Quick.git', :branch => 'swift-2.0'
  pod 'GRValidation', '~> 0.2'
#  pod "SwiftCheck", :git => 'https://github.com/zbeckman/SwiftCheck.git', :branch => 'swift-develop'
end

target 'GlimpulseIntegrationTests' do
  pod "SwiftSpinner", :git => 'https://github.com/zbeckman/SwiftSpinner.git'
  pod 'XCGLogger', :git => 'https://github.com/DaveWoodCom/XCGLogger.git', :branch => 'swift_2.0'
  pod "Nimble", :git => 'https://github.com/Quick/Nimble.git', :branch => 'swift-2.0'
  pod "Quick", :git => 'https://github.com/zbeckman/Quick.git', :branch => 'swift-2.0'
  pod 'GRValidation', '~> 0.2'
#  pod "SwiftCheck", :git => 'https://github.com/zbeckman/SwiftCheck.git', :branch => 'swift-develop'
end

link_with 'GlimpulseUITests'
link_with 'GlimpulseIntegrationTests'



Best Answer-推荐答案


啊哈。好的,我想我想通了,在经历了删除、重新创建、pod installing 和重复......以及摆弄 Xcode 目标的痛苦和折磨之后。我的发现:

Cocoapods 0.38.2 不喜欢 Xcode 7 beta 6 的新“iOS UI 测试包”目标类型。

在设置新目标并运行 pod install 时,主要问题很明显。安装似乎运行良好,但如果您查看构建阶段,则缺少 Embed pods frameworks 阶段。但是,如果我手动创建此阶段(根据目标调整路径),它确实会构建。

但是...奇怪的事情仍然发生。上面显示的错误(关于当前架构的链接)仍然会发生。这是最奇怪的部分:如果我将目标更改为使用“仅为事件架构构建: ' 然后一切正常。我没有得到最后一点,因为 pod 应该只为当前架构构建。但是...如果集成失败了...好吧,谁知道呢,也许它会在下一个 Cocoapods 版本中得到修复。

另一个令人失望的发现:新的 UI 测试目标类型 似乎支持 @testable 功能。真可惜。希望他们将其添加到 Xcode 7 的最终版本中...

关于ios - Cocoapods 没有正确链接第三、第四个目标(Xcode 7 beta 6),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32368665/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4