Cocoapods: [1.6.0.beta.1] No such module "Firebase" in Swift Tests

Created on 21 Aug 2018  路  21Comments  路  Source: CocoaPods/CocoaPods

Report

Upgrading CocoaPods to 1.6.0.beta.1 (from 1.5.3) breaks my Swift unit tests with a "No such module 'Firebase'" error

What did you do?

gem install cocoapods --pre

What did you expect to happen?

Nothing to change except the version# in the Podfile.lock :)

What happened instead?

old, working: "${SRCROOT}/../Pods/Target Support Files/Pods-Taco/Pods-Taco-frameworks.sh",
new, busted: "${PODS_ROOT}/Target Support Files/Pods-Taco/Pods-Taco-frameworks.sh",

(I have no idea why this matters, those paths map to the same location. maybe it's a red herring?)

CocoaPods Environment

Stack

   CocoaPods : 1.6.0.beta.1
        Ruby : ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
    RubyGems : 2.5.1
        Host : Mac OS X 10.13.6 (17G65)
       Xcode : 9.4.1 (9F2000)
         Git : git version 2.14.1
Ruby lib dir : /usr/local/Cellar/ruby/2.3.1/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 39056189d4920e85670b12dda1750be61ee34ea2

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate  : 1.0.2
cocoapods-dependencies : 1.1.0
cocoapods-plugins      : 1.0.0
cocoapods-search       : 1.0.0
cocoapods-stats        : 1.0.0
cocoapods-trunk        : 1.3.1
cocoapods-try          : 1.1.0

Podfile

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
use_frameworks!
workspace 'Recharge'

# ignore compiler warnings from Pods
inhibit_all_warnings!

target 'Consumer' do
  project 'consumer/Consumer.xcodeproj'

  # Local pods
  pod 'CommonAPI', :path => 'CommonAPI'

  # Third-party pods
    pod 'GoogleMaps'
    pod 'GooglePlaces'
    pod 'Alamofire'
    pod 'SwiftyJSON'
    pod 'ObjectMapper'
    pod 'PromiseKit/CorePromise'
    pod 'SwiftyUserDefaults'
    pod 'EmitterKit'
    pod 'Stripe'
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'
    pod 'libPusher'
    pod 'RSKImageCropper'
    pod 'SDWebImage'
    pod 'KMPlaceholderTextView'
    pod 'libPhoneNumber-iOS'
    pod 'Mixpanel'
    pod 'CocoaLumberjack/Swift'
    pod 'LogglyLogger-CocoaLumberjack'
    pod 'Bugsnag'
    pod 'Sift'
    pod 'TTTAttributedLabel'
    pod 'pop'
    pod 'Branch'
    pod 'Firebase/Core'
    pod 'PureLayout'
    pod 'markymark', :git => 'https://github.com/edenman/Marky-Mark/', :commit => 'fcc845dc64388b14fbe3dce3b471bbfce47d1552'
    pod 'Reveal-SDK', :configurations => ['Debug']

    target 'ConsumerTests' do
        inherit! :search_paths
  end
end

target 'Taco' do
  project 'taco/Taco.xcodeproj'

  # Local pods
  pod 'CommonAPI', :path => 'CommonAPI'

  # Third-party pods
    pod 'Alamofire'
    pod 'SwiftyJSON'
    pod 'ObjectMapper'
    pod 'PromiseKit/CorePromise'
    pod 'SwiftyUserDefaults'
    pod 'EmitterKit'
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'
    pod 'RSKImageCropper'
    pod 'SDWebImage'
    pod 'libPhoneNumber-iOS'
    pod 'Mixpanel'
    pod 'CocoaLumberjack/Swift'
    pod 'LogglyLogger-CocoaLumberjack'
    pod 'Bugsnag'
    pod 'pop'
    pod 'Branch'
    pod 'PureLayout'
    pod 'markymark', :git => 'https://github.com/edenman/Marky-Mark/', :commit => 'fcc845dc64388b14fbe3dce3b471bbfce47d1552'
    pod 'Reveal-SDK', :configurations => ['Debug']

    target 'TacoTests' do
        inherit! :search_paths
  end
end

Project that demonstrates the issue

WIP, I'll post a link when it's done

confirmed defect

All 21 comments

Thanks for the report! Yeah a sample app would help here to figure this out. I'll try to use the Podfile you have in a sample app.

@edenman the sample project is missing Taco.xcodeproj

Commented out that target but Burrito does not use Firebase so build was successful. I will try it in a sample app of mine.

Can compile both Burrito and BurritoTests target (I copied over all pods from Taco into Burrito targets).

screen shot 2018-08-21 at 4 54 28 pm

I was using master (355bda2a4b8bd00748650a8d293626f4e118b69a) but it only has 3 unrelated changes to 1.6.0.beta.1 so I don't think something has been fixed since then.

Would need an updated sample.

errant .git folder caused taco to not get added. fixed now

Definitely can repro. Probably related to new build settings. Tracked for 1.6.0.

Maybe worth noting: it's only repro-able if you _use_ Firebase in the Taco app. If you remove the import and the call from AppDelegate, the tests work fine.

Please post the repro steps starting with git clone [email protected]:edenman/cocoapods-firebase-bug.git. Which workspace or project? Which build target? What other steps?

I see the same build issue in TacoTests with both 1.5.3 and 1.6.0.

  • git clone [email protected]:edenman/cocoapods-firebase-bug.git
  • cd cocoapods-firebase-bug
  • pod install
  • open Xcode, open cocoapods-firebase-bug.xcworkspace
  • run TacoTests in Xcode

With those steps, my 1.6.0 build gets further than the 1.5.3 one. 1.5.3 fails building the Taco target and 1.6.0 successfully builds Taco and fails building TacoTests.

I'm also seeing something similar on my client's app (sorry but I had to redact the client's name)

This is with Xcode 10 & New Build System, but with Xcode 9.4 I'm seeing similar results.

The app's Podfile looks like this:

workspace 'AppName'
platform :ios, '9.0'
use_modular_headers!
inhibit_all_warnings!

target 'AppName' do

    pod 'RxCocoa'
    pod 'Firebase/Core'
    target 'Tests' do
        pod 'Nimble', '7.1.1'
        inherit! :search_paths 
    end
end

Seeing this issue as well with Xcode 9.4 + CP 1.6.0.beta.1 :/

I believe I'm seeing a similar issue in CP 1.6.0.beta.1 around running tests with use_frameworks!, though it seems like the tests work correctly using static rather than dynamic frameworks.

This also appears to work fine if the test target is a separate top-level target rather than chained inside the main target, but I ran into other issues with that pattern related to name spacing and Swift which means I cannot use that workaround.

Also, I had a case where I was able to revert the "Embed Pods Frameworks" build step for the Unit Test target and it worked again, which leads me to believe that there is some bug around linking dependencies into the test targets (but only when they are inside the main target).

I've encountered the same problem. Looks like a regression of https://github.com/firebase/firebase-ios-sdk/issues/16

I was able run the tests with the following workaround:

  • Change import Firebase to import FirebaseCore
  • Add "${PODS_ROOT}/FirebaseCore/Firebase/Core/Public" to your Tests target only under Build Settings -> Header Search Paths

hm... adding "${PODS_ROOT}/FirebaseCore/Firebase/Core/Public" does not work for me this time arround :/

Similar to fonkadelic's comment, I had to change all of my umbrella "import Firebase" statements to use the specific framework, e.g. (import FirebaseCore, import FirebaseAuth, import FirebaseRemoteConfig, etc.)

The location of the Firebase.h and module.modulemap has changed from Firebase 4 to Firebase 5. The workaround would now be:

  • Add "${PODS_ROOT}/Firebase/CoreOnly/Sources" to your Tests target only under Build Settings -> Header Search Paths

To make sure to get the location right for the Firebase version do:

$ grep -r "module Firebase " *
Pods/Firebase/CoreOnly/Sources/module.modulemap:module Firebase {

I think this was duplicated by https://github.com/CocoaPods/CocoaPods/issues/8497.

Will verify https://github.com/CocoaPods/CocoaPods/issues/8497 fix and then see if it fixes this one as well and push this up to 1.6.1 instead.

Confirmed with https://github.com/CocoaPods/CocoaPods/pull/8500 that it fixes this issue.

I've encountered the same problem. Looks like a regression of firebase/firebase-ios-sdk#16

I was able run the tests with the following workaround:

  • Change import Firebase to import FirebaseCore
  • Add "${PODS_ROOT}/FirebaseCore/Firebase/Core/Public" to your Tests target only under _Build Settings -> Header Search Paths_

Thanks buddy it solved my error

Was this page helpful?
0 / 5 - 0 ratings