0
votes

enter image description hereWhen I compile in Test I always get this result "No such module 'RealmSwift'".

I have the following in the 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

I've tried it and I'm still getting the same result.

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

I have also deleted the "Pods" folder of my project, the file "Podfile. lock" and the "App. xcworkspace" and then I run pod install.

I'm working with Xcode 8.3.3 and Swift 3

2
What other errors, if any, do you see when building in Xcode? Being unable to find a module typically indicates that a module (or something it depends on) failed to build.bdash
I added a screenshot.Fredy B.

2 Answers

2
votes

I had to add to the test targets:

  target' AppTests' do
    inherit! : search_paths
  end

The "@testable import App" must be included in each Test file (which corresponds to the name of the main Target)

The Test file MUST NOT include any files (in the target membership) that are not Test files.

0
votes

I had the same issue. the thing that worked for me is the following:

if you're using Xcode 9. just update it with the recommended settings. then Xcode will recognize Realm.