Cocoapodstesting链接器错误

每当我构build我的testing目标(Xcode生成的标准目标)时,构build失败并带有一个模糊的错误:

framework not found Pods_AppName_AppNameTests 

我认为没有find我的testing生成目标的荚。 我的podfile非常简单:

 use_frameworks! target 'AppName' do pod 'ReactiveCocoa' pod 'RealmSwift' pod 'ObjectMapper' pod 'Moya' pod 'Moya/ReactiveCocoa' pod 'pop' pod 'Heimdallr' pod 'Heimdallr/ReactiveCocoa' pod 'Alamofire' pod 'AlamofireImage' pod 'SwiftDate' pod 'DropdownAlert' pod 'NibDesignable' target 'AppNameTests' do pod 'Quick' pod 'Nimble' end end 

我正在使用Cocoapods 1.0.1。

编辑:

这不是我的podfile的格式。 这是通过运行pod init给予我的默认设置。 cocoapods中可能有一个bug,但格式是正确的。

编辑2:

如果我包括:

 inherit! search_paths 

在我的testing目标中,testing失败说:

 The bundle “MyApp_Tests” couldn't be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 

没有这一行,testing也无法build立,但这次与链接器错误:

Ld /Users/travis/Library/Developer/Xcode/DerivedData/Reactify-fqgxzcgedmqljrangqdkxpwdfxne/Build/Intermediates/Reactify.build/Debug-iphonesimulator/Reactify_Tests.build/Objects-normal/i386/Reactify_Tests normal i386

这个特殊的错误是来自特拉维斯,但我本地在Xcode中得到相同的。

上周我也一直在和这个争斗 – 我最终发现可靠工作的“解决scheme”是添加inherit! search_paths inherit! search_paths ,pod install,然后删除它,然后再从testing目标安装pod,如下所示:

 source 'https://github.com/CocoaPods/Specs.git' project 'CityWeather/CityWeather.xcodeproj' install! 'cocoapods', :deterministic_uuids => false use_frameworks! platform :ios, '9.3' abstract_target 'CityWeather_Base' do <... pod list here, contents don't seem to matter ...> target 'CityWeather' do end target 'CityWeatherTests' do # NB. If it starts refusing to link the test frameworks, # adding and then removing inherit! :search_paths here appears to help. #inherit! :search_paths end end 

至less比每当它发生时创造一个新的目标更less麻烦,从我上个星期来看,我预计不久将发生在你身上。 很烦人。 尽可能多地花费时间来尝试从提交日志中推断问题出现的地方,但这并不是直截了当的。 如果我能够find足够的时间来解决问题,那么我会在这里更新。 但在此期间,希望我的“解决scheme”可以提高您的生产力。

这是最奇怪的事情,我绝对尝试过,但是我刚刚删除了testing目标,创build了一个新的testing目标,看哪,它的工作。 据我所知,唯一的区别是两个目标之间是一个被称为MyApp_Tests和另一个MyApp_ExampleTests 。 如果这是原因,我会感到惊讶,但在这一点上很难说。

我会说,虽然作为一个侧面说明,我所指的项目不是我见过的唯一一个项目。 我的最后四个项目遇到了这个错误,都是从Cocoapods 1.0.0开始创build的。 这使我相信Cocoapodstesting设置中存在一些隐藏的错误,我将不得不进行更多的调查。

另外,删除testing目标并创build一个新的testing目标似乎只适用于这种情况。 在其他项目中,错误仍然存​​在。 我可以告诉它不仅仅是我的本地设置,因为我的travis版本也会一直失败。