[英]How to fix missing module in unit-test file?
So I'm very new with unit test in Swift. 所以我对Swift中的单元测试非常新。 In my project I'm using a couple of frameworks installed in my cocoa pods, but when I was about to write some code in my test file, I always get this error. 在我的项目中,我使用了几个安装在我的可可豆荚中的框架,但是当我要在我的测试文件中编写一些代码时,我总是会遇到这个错误。 missing module: Firebase, Eureka, ImageRow
I tried to import these modules above the @testable, but somehow it didn't recognize the module. 我试图在@testable上面导入这些模块,但不知怎的,它无法识别模块。 it keeps on saying module not found
. 它继续说module not found
。 I've also tried to remove my pods inside the inherit search paths
, and it still on asking that I need to import these module. 我还尝试在inherit search paths
删除我的pod,它仍然要求我需要导入这些模块。 Here's my cocoa pod. 这是我的可可豆荚。
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
target 'ProjectRedTests' do
inherit! :search_paths
pod 'Firebase'
pod 'Eureka'
pod 'ImageRow'
pod ‘Firebase/Database’
pod ‘Firebase/Storage’
For me putting those modules in ProjectRedTests worked. 对我来说,将这些模块放在ProjectRedTests中。
You need to add those frameworks to your test target also. 您还需要将这些框架添加到测试目标中。
(Note: you may need to add a Copy Files phase before Link Binary With Libraries to get them into the right position.) (注意:您可能需要在Link Binary With Libraries之前添加Copy Files阶段,以使它们进入正确的位置。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.