Cocoapods 没有正确链接到第 3 个、第 4 个目标(Xcode 7 beta 6)
Cocoapods not linking correctly for 3rd, 4th target (Xcode 7 beta 6)
我在使用 Cocoapods 和 Xcode 7 beta 6 时遇到问题:我有一个包含三个不同测试目标(测试、UITests、IntegrationTests)的项目。我的 pods 似乎在第一个目标 ("tests") 上工作得很好,但其他目标有问题:
- 如果我在后两个目标中不引用任何 Cocoapods,一切都会正常构建。
- 但是,当我尝试使用 pods 之一(在本例中为 XCGLogger)时,出现链接器错误。
- 我检查了构建阶段,发现两个目标都缺少
Embed Pods Frameworks
,所以我手动添加了它。
- 这样做并清理、删除派生数据后,问题仍然存在。
随附显示链接器错误的屏幕截图。同样,只有当我尝试在后两个目标中使用 XCGLogger 时才会发生这种情况。它在第一个目标中运行良好。
为了彻底...这是我正在使用的 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'
只需将此格式用于您的 Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
target 'firstTarget', :exclusive => false do
platform :ios, '7.0'
pod 'SwiftSpinner', '~> 0.7'
pod 'XCGLogger', '~> 2.3'
pod 'Nimble', '2.0.0-rc.3'
pod 'Quick', '~> 0.6'
pod 'GRValidation', '~> 0.2'
end
... repeat for every target
在 cocoapods.org
找到 pod
语法。
啊哈。好吧,我想我明白了,在经历了删除、重新创建、pod install
ing 和重复...以及摆弄 Xcode 目标的巨大痛苦之后。我的发现:
Cocoapods 0.38.2 不喜欢 Xcode 7 beta 6 的新 "iOS UI Testing Bundle" 目标类型。
主要问题在设置新目标和 运行ning pod install
时很明显。安装似乎 运行 正常,但如果您查看构建阶段,就会发现缺少 Embed pods frameworks
阶段。但是,如果我手动创建此阶段(根据目标调整路径),它会构建。
但是... 奇怪的事情还是发生了。上面显示的错误(关于当前体系结构的链接)仍然会发生。 这是最奇怪的部分:如果我将目标更改为使用 'Build for active architecture only: NO' 那么一切正常。我不明白最后一点,因为 pods 应该只为当前架构构建。然而...如果集成被破坏那么...好吧,谁知道呢,也许它会在下一个 Cocoapods 版本中得到修复。
另一个令人失望的发现:新的 UI 测试目标类型似乎 不 支持 @testable
功能。无赖。希望他们将其添加到 Xcode 7...
的最终版本中
Cocoapods 0.38.2 与 xcode 7 有问题,如上所述。我遇到过这个问题并通过将 cocoapods 版本降级到 0.35.0 来修复它。在终端中使用 gem uninstall cocoapods 来卸载。
我在使用 Cocoapods 和 Xcode 7 beta 6 时遇到问题:我有一个包含三个不同测试目标(测试、UITests、IntegrationTests)的项目。我的 pods 似乎在第一个目标 ("tests") 上工作得很好,但其他目标有问题:
- 如果我在后两个目标中不引用任何 Cocoapods,一切都会正常构建。
- 但是,当我尝试使用 pods 之一(在本例中为 XCGLogger)时,出现链接器错误。
- 我检查了构建阶段,发现两个目标都缺少
Embed Pods Frameworks
,所以我手动添加了它。 - 这样做并清理、删除派生数据后,问题仍然存在。
随附显示链接器错误的屏幕截图。同样,只有当我尝试在后两个目标中使用 XCGLogger 时才会发生这种情况。它在第一个目标中运行良好。
为了彻底...这是我正在使用的 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'
只需将此格式用于您的 Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
target 'firstTarget', :exclusive => false do
platform :ios, '7.0'
pod 'SwiftSpinner', '~> 0.7'
pod 'XCGLogger', '~> 2.3'
pod 'Nimble', '2.0.0-rc.3'
pod 'Quick', '~> 0.6'
pod 'GRValidation', '~> 0.2'
end
... repeat for every target
在 cocoapods.org
找到 pod
语法。
啊哈。好吧,我想我明白了,在经历了删除、重新创建、pod install
ing 和重复...以及摆弄 Xcode 目标的巨大痛苦之后。我的发现:
Cocoapods 0.38.2 不喜欢 Xcode 7 beta 6 的新 "iOS UI Testing Bundle" 目标类型。
主要问题在设置新目标和 运行ning pod install
时很明显。安装似乎 运行 正常,但如果您查看构建阶段,就会发现缺少 Embed pods frameworks
阶段。但是,如果我手动创建此阶段(根据目标调整路径),它会构建。
但是... 奇怪的事情还是发生了。上面显示的错误(关于当前体系结构的链接)仍然会发生。 这是最奇怪的部分:如果我将目标更改为使用 'Build for active architecture only: NO' 那么一切正常。我不明白最后一点,因为 pods 应该只为当前架构构建。然而...如果集成被破坏那么...好吧,谁知道呢,也许它会在下一个 Cocoapods 版本中得到修复。
另一个令人失望的发现:新的 UI 测试目标类型似乎 不 支持 @testable
功能。无赖。希望他们将其添加到 Xcode 7...
Cocoapods 0.38.2 与 xcode 7 有问题,如上所述。我遇到过这个问题并通过将 cocoapods 版本降级到 0.35.0 来修复它。在终端中使用 gem uninstall cocoapods 来卸载。