Search code examples
swiftobjective-cfirebasecocoapodsfirebase-remote-config

How can I get my Swift/Objective-C project to recognise my Firebase Remote Config cocoapod?


I am having trouble importing Firebase Remote Config via Cocoapods into a hybrid Swift/Objective C project and only get a No such module 'FirebaseRemoteConfig' warning:

enter image description here

Here is my podfile:

# This pod file uses cocoapods 1.0.0.beta.6
platform :ios, '12.1'
use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

def analytics
    pod 'Firebase/Core', '= 9.0.0', :inhibit_warnings => true
    pod 'Firebase/Crashlytics', '= 9.0.0', :inhibit_warnings => true
    pod 'Firebase/AnalyticsWithoutAdIdSupport', '= 9.0.0', :inhibit_warnings => true
    pod 'FirebaseRemoteConfig', '= 9.0.0', :inhibit_warnings => true
end

target 'Settings' do
    project 'Settings/Settings.xcodeproj'
    target 'SettingsTests' do
        inherit! :search_paths
        analytics
    end
end

I use the other Firebase pods I import in Objective C classes without issue via the following:

#import <Firebase/Firebase.h>
#import <FirebaseAnalytics/FirebaseAnalytics.h>

but the RemoteConfig pod is used solely within a Swift class and I just can't get it to be picked up!

I had it working previously by moving Firebase completely to Swift Package Manager dependencies, however, due to a common class reference between Firebase and GoogleMLKit and GoogleMLKit not having yet made the transition to SwiftPM, I cannot have both SwiftPM and Cocoapods dependencies in place without crashing.

I have also tried:

  • deleting derived data
  • pod reintegrate
  • pod cache clean --all
  • pod install

without success. Any help would be most appreciated!


Solution

  • Managed to find the issue, needed to import the analytics function thus so:

    target 'Settings' do
        project 'Settings/Settings.xcodeproj'
        analytics
        target 'SettingsTests' do
            inherit! :search_paths
            analytics
        end
    end