2017-05-04 67 views
1

我有一個使用XCTest框架的CocoaPod。要將XCTest導入到吊艙,我將s.frameworks = 'XCTest'添加到了.podspec文件中。將s.frameworks'XCTest'添加到podspec dyld時出錯:未加載庫:rpath/XCTest.framework/XCTest

我現在可以導入XCTest到POD類,但試圖運行示例項目時,我收到以下錯誤:

dyld: Library not loaded: @rpath/XCTest.framework/XCTest

Referenced from: /Developer/CoreSimulator/Devices/DEVICE_UUID/data/Containers/Bundle/Application/ID/TestPod_Example.app/Frameworks/TestPod.framework/TestPod

Reason: image not found

回答

1

找到了解決方案,在podspec添加XCTest框架時,請務必將其添加到您的UITesting和測試目標中,僅在Podfile ..這是因爲XCTest無法在開發目標上運行,只能在測試目標上運行。

在你Podfile

target 'MyProjectTestTarget' do 
    pod 'PodFramework that includes XCTest as a dependency' 
end 
+0

嗨,你可以給你的「將它添加到您的UITesting只有在Podfile測試目標」是什麼意思的例子嗎? – BadmintonCat

+0

當然@BadmintonCat我修改了答案。如果你能碰到我的問題和答案,那就太棒了! ;) –

+0

謝謝,完成! :) – BadmintonCat