2017-05-25 61 views
0

所以我在Swift中使用單元測試很新。在我的項目中,我使用了幾個安裝在我的可可豆中的框架,但是當我準備在我的測試文件中編寫一些代碼時,我總是得到這個錯誤。 missing module: Firebase, Eureka, ImageRow如何修復單元測試文件中缺失的模塊?

enter image description here

我試圖導入@testable上述這些模塊,但不知何故,它不承認該模塊。它一直說module not found。我也嘗試刪除inherit search paths中的我的容器,並且仍然詢問我是否需要導入這些模塊。這是我的可可豆莢。

target 'ProjectRed' do 

    use_frameworks! 
    pod 'Firebase' 
    pod 'Eureka' 
    pod 'ImageRow' 
    pod ‘Firebase/Database’ 
    pod ‘Firebase/Storage’ 

    # Pods for ProjectRed 

    target 'ProjectRedTests' do 
    inherit! :search_paths 
    # Pods for testing 
    end 

    target 'ProjectRedUITests' do 
    inherit! :search_paths 
    # Pods for testing 
    end 

end 

回答

0

您還需要將這些框架添加到測試目標。

  1. 在項目的目標部分選擇測試目標。
  2. 選擇Build Phases選項卡。
  3. 將您的框架添加到「鏈接二進制庫」部分。

(注意:您可能需要之前鏈接二進制與圖書館添加一個複製文件階段,讓他們到合適的位置)

0
target 'ProjectRedTests' do 
    inherit! :search_paths 
    pod 'Firebase' 
    pod 'Eureka' 
    pod 'ImageRow' 
    pod ‘Firebase/Database’ 
    pod ‘Firebase/Storage’ 

對我來說,把這些模塊ProjectRedTests工作。