Firebaseui-ios: “Use of '@import' when modules are disabled” Error for FirebaseUiAuth

Created on 17 Jun 2020  Â·  5Comments  Â·  Source: firebase/FirebaseUI-iOS

Step 1: Are you in the right place?

80% chance :thinking:

Step 2: Describe your environment

  • Objective C or Swift: Swift5
  • iOS version: 13.5
  • Firebase SDK version: 6.6
  • FirebaseUI version: 8.4.0
  • CocoaPods Version: 1.9.1

Step 3: Describe the problem:

Using FirebasUI dependencies in kotlin-native with cocoapods support throws error during compilation.
Not sure if valid fix, but if I replace module imports in FirebaseUI code then our project compiles successfully.

  • @import UIKit; => #import <UIKit/UIKit.h>
  • @import Foundation => #import <Foundation/Foundation.h>

edit:

  • setting Enable modules (C and Object-c) is true for project.
  • cacaopods Podfile contains use_frameworks! :linkage => :static

Steps to reproduce:

  1. Add 'FirebaseUI/Google dependency to to kotlin-native project
  2. Execute gradle podspec cmd
  3. Execute pod install
  4. Build iOS project
  5. Observe error

Observed Results:

Use of '@import' when modules are disabled

error is thrown in 3 places:

Expected Results:

Successful compilation

Most helpful comment

All 5 comments

Hi. I am having the same issue building FirebaseUI for iOS, mixing C++ and ObjectiveC. No idea how to fix this. Any help?
Edit: I managed to fix it following @Audkar suggestion. I am not sure about further implications of replacing @import by #import. Anyways, It would be handy if the FirebaseUI team replaces the source with these modifications to make the framework compatible with Objective-C++ code.

@morganchen12 would you accept PR which replaces these imports?

Yes, PRs are very welcome.

Using -fmodules and -fcxx-modules flags fixes this as long as the file extension is .m
(but not supported by .mm or rather Objective-C++ yet, year 2021).

Note that I tested with both g++ and clang++ compilers (as I really wanted to make this work).

Was this page helpful?
0 / 5 - 0 ratings