2017-10-18 195 views
0

enter image description here当我在测试中编译我总是得到这个结果“没有这样的模块'RealmSwift'”。没有这样的模块'RealmSwift'

我在podfile中有以下内容。

source 'https://github.com/CocoaPods/Specs.git' 
platform :ios, '9.0' 
# ignore all warnings from all pods 
inhibit_all_warnings! 

target 'App' do 
    use_frameworks! 
    pod 'RealmSwift' 
    pod 'Fabric', '~> 1.6.3' 
    pod 'Answers', '~> 1.3.5' 
    pod 'DropDown', '~> 2' 
end 

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
    target.build_configurations.each do |config| 
     config.build_settings['SWIFT_VERSION'] = '3.0' # or '3.0' 
    end 
    end 
end 

我试过了,我仍然得到相同的结果。

pod --version 
pod cache clean Realm 
pod cache clean RealmSwift 
pod deintegrate || rm -rf Pods 
pod install --verbose 
rm -rf ~/Library/Developer/Xcode/DerivedData 

我也删除了我的项目,文件“Podfile。锁定”和“应用程序。xcworkspace”的“豆荚”文件夹,然后我跑吊舱安装。

我在Xcode 8.3.3和斯威夫特3

+0

在Xcode中构建时,您还会看到哪些其他错误(如果有)?无法找到模块通常表示模块(或其依赖的某个模块)无法构建。 – bdash

+0

我添加了一个截图。 –

回答

1

工作,我不得不添加到测试目标:

target' AppTests' do 
    inherit! : search_paths 
    end 

的“@testable导入应用程序”必须包含在每个测试文件(其对应于主要目标的名称)

测试文件不得包含任何非测试文件(在目标成员资格中)的文件。

0

我有同样的问题。这对我的工作是以下内容:

如果您使用Xcode 9,只需使用建议的设置进行更新。那么Xcode将识别Realm。

相关问题