Cocoapods无法正确链接第3个,第4个目标(Xcode 7 beta 6) [英] Cocoapods not linking correctly for 3rd, 4th target (Xcode 7 beta 6)

查看:47
本文介绍了Cocoapods无法正确链接第3个,第4个目标(Xcode 7 beta 6)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Cocoapods和Xcode 7 beta 6时遇到问题:我有一个项目,其中包含三个不同的测试目标(测试,UITests,IntegrationTests)。我的广告连播似乎与第一个目标(测试)配合得很好,但其他目标却遇到了问题:

I'm having a problem with Cocoapods and Xcode 7 beta 6: I have a project with three different test targets (tests, UITests, IntegrationTests). My pods seem to be working just fine with the first target ("tests") but the other targets are having problems:


  • 一切都在构建如果我在后两个目标中均未引用任何Cocoapods,则可以。

  • 但是,当我尝试使用其中一个Pod(在这种情况下为XCGLogger)时,出现链接器错误

  • 我检查了构建阶段,发现两个目标都缺少 Embed Pods Frameworks ,因此我手动添加了它。 / li>
  • 执行此操作并清理后,删除派生数据,问题仍然存在。

  • Everything builds just fine if I don't reference any of the Cocoapods in the latter two targets.
  • However, when I try to use one of the pods (XCGLogger in this case), I get linker errors.
  • I checked the build phases, and found that Embed Pods Frameworks was missing from both targets, so I manually added it.
  • After doing this and cleaning, deleting derived data, the problem still exists.

附件显示链接器错误。同样,仅当我尝试在后两个目标中使用XCGLogger时,才会发生这种情况。

Screenshot is attached that shows the linker error. Again this only happens if I try to use the XCGLogger in the latter two targets. It works fine in the first target.

要彻底...这里是我正在使用的Podfile:

Just to be thorough... here's the Podfile I'm using:

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'


推荐答案

啊哈。好的,我认为在解决,删除,重新创建, pod安装,重复和重复……以及摆弄Xcode目标之后,我经历了很多痛苦。我的发现:

Aha. Ok, I think I figured it out, after much pain and suffering with deleting, recreating, pod installing, and repeating... and fiddling with Xcode targets. My findings:

Cocoapods 0.38.2不喜欢Xcode 7 beta 6的新 iOS UI Testing Bundle目标类型。

设置新目标并运行 pod install 时,主要问题显而易见。安装看起来运行良好,但是如果您查看构建阶段,则缺少 Embed pods frameworks 阶段。但是,如果我手动创建此阶段(调整路径以适合目标),则它确实会建立。

The main problem is evident when setting up the new target and running pod install. The install appears to run fine but if you look at the build phases, the Embed pods frameworks phase is missing. However, if I manually create this phase (adjusting the paths as appropriate for the target), it does build.

但是... 仍然很奇怪。上面显示的错误(关于当前体系结构的链接)仍然会发生。这是最奇怪的部分:如果我将目标更改为仅针对活动体系结构构建: '然后一切正常。最后一点我不明白,因为吊舱仅应针对当前架构建造。但是...如果集成遭到重创,那么...好吧,谁知道,也许它会在下一个Cocoapods版本中得到修复。

BUT... Something weird still happens. The errors shown above (regarding linking for the current architecture) still occur. And here's the strangest part: If I change the target to use 'Build for active architecture only: NO' then everything works just fine. I don't get this last bit, because the pods should only be built for the current architecture. However... if the integration is whacked then... OK, who knows, maybe it gets fixed in the next Cocoapods release.

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

One other disappointing discovery: The new UI Test target type does not appear to support the @testable feature. Bummer. Hope they add that into the final release of Xcode 7...

这篇关于Cocoapods无法正确链接第3个,第4个目标(Xcode 7 beta 6)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆