Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No such module `Quick` using cocoapods

I've been learning swift for three days. I'm planning to build my skill in swift especially in iOS development. I just advised by my colleague who is an iOS developer to learn swift while writing test in our app -- this is for the benefit to the company and myself which it makes sense for me. Now, I'm trying to follow this tutorial https://medium.com/@ynzc/getting-started-with-tdd-in-swift-2fab3e07204b

After following the tutorial to rewrite the test in a framework called Quick which is very similar with Rspec. I did the installation of the CocoaPod then follow the install of the Quick framework. Use the .xcworkspaces instead of the .xcodeproj. But still I'm getting the error of No such module 'Quick'.

I did research already and removing the pods but still getting the error.

platform :ios, '9.2'

target 'FizzBuzz' do
  use_frameworks!

  def test_pods
    pod 'Quick', '~> 0.9.0'
    pod 'Nimble', '~> 3.2.0'
  end

  target 'FizzBuzzTests' do
    inherit! :search_paths
    test_pods
  end

  target 'FizzBuzzUITests' do
    inherit! :search_paths
    test_pods
  end

end

screenshot of the project folder:
screenshot of the project folder

like image 584
Pepeng A. Avatar asked Oct 02 '16 17:10

Pepeng A.


2 Answers

I recently had this issue and none of the current answers solved this for me.

The reason I was getting this error was that the Test/Spec file (NetworkSpec.swift) that I had created had a target membership of the main application target, not the tests target.

To update this, I opened the project in xcode, selected the file in the project explorer and then in the properties window on the right hand side. Then in the target membership area. I had two options.

  • ProjectName
  • ProjectNameTests

I unchecked the checkbox next to ProjectName (not the app's real name) and then checked the one next to ProjectNameTests and re-ran the tests. Everything worked as expected.

like image 113
Scriptable Avatar answered Oct 15 '22 11:10

Scriptable


I ran into the same issue. I did not need to nest the test targets in my podfile. e.g.

source 'https://github.com/CocoaPods/Specs.git'

use_frameworks!

target 'MyAppName' do
    pod 'RealmSwift'
    pod 'GoogleMaps'
end

target 'MyAppNameTests' do
    inherit! :search_paths
    pod 'Quick'
    pod 'Nimble'
end

target 'MyAppNameUITests' do
    inherit! :search_paths
    pod 'Quick'
    pod 'Nimble'
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 am using Xcode 8.1. Click on the currently selected scheme.

Select 'manage schemes'.

Selected scheme.

Put check mark next to test schemes and Quick.

Click on your app scheme again. Select each scheme and go to Product > Build. Finally select your main app scheme again. Now try adding 'import Quick' in one of your test classes.

Schemes

like image 24
Matt Avatar answered Oct 15 '22 11:10

Matt