2017-04-21 29 views
0

想不通为什么报告FBSnapshotTestCase image not found while running Xcode test运行Xcode测试时找不到FBSnapshotTestCase图片

我试图链接目标ChartTests中的FBSnapshotTestCase,但仍然看到相同的错误。

我不熟悉这个,任何人都可以帮忙吗?预先感谢。

重现:

https://github.com/danielgindi/Charts

下载项目导航到项目的根,

  1. (可选)运行carthage bootstrap安装依赖。该项目有一个依赖项检查,所以如果你不运行它,它会在启动测试时运行它。

  2. 进入

    xcodebuild联编 - 项目 'Charts.xcodeproj' -scheme 'ChartsTests' 构型的 '调试' -sdk iphonesimulator -destination ID = 'E40B5365-EF82-430D-A767-2A37995CCEE1' 干净的构建测试

目标id可以是在机器上模拟器的任何UUID。

然后报告:

2017-04-20 13:47:57.611 xctest[90924:13099756] The bundle “ChartsTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. 
2017-04-20 13:47:57.611 xctest[90924:13099756] (dlopen_preflight(/Users/user/Library/Developer/Xcode/DerivedData/Charts-ambsdrskvocwekcmoobyhanaiixm/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ChartsTests.xctest/ChartsTests): Library not loaded: @rpath/FBSnapshotTestCase.framework/FBSnapshotTestCase 
    Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Charts-ambsdrskvocwekcmoobyhanaiixm/Build/Intermediates/CodeCoverage/Products/Debug-iphonesimulator/ChartsTests.xctest/ChartsTests 
    Reason: image not found) 
2017-04-20 13:47:57.625 xcodebuild[90311:13086990] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted} 

Testing failed: 
    Test target ChartsTests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted) 
** TEST FAILED ** 

回答

0

原来我需要添加在构建阶段运行脚本,并让迦太基复制框架:

副本从https://github.com/Carthage/Carthage#if-youre-building-for-ios-tvos-or-watchos

在您的应用程序目标“”构建阶段“设置”选项卡,单击“+”图标并选择“新建运行脚本阶段”。创建在其中可以指定你的shell一个运行脚本(例如:/ bin/sh的),添加以下内容到shell脚本如下区域:

/usr/local/bin/carthage copy-frameworks 

和路径添加到您想要在使用框架“输入文件”,例如:

$(SRCROOT)/Carthage/Build/iOS/FBSnapshotTestCase.framework 
相关问题