2017-10-18 191 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。

相關問題