Could not build Objective-C module 'Firebase&#

2019-08-02 01:55发布

问题:

I am getting this error for import Firebase:

Could not build Objective-C module 'Firebase'

Xcode also complains about FirebaseAnalytics saying

'FirebaseAnalytics/FirebaseAnalytics.h' file not found.

My project used to build just fine until I updated to swift 4.

I am using the latest version of Firebase via Cocoapods version 1.4.0 beta 2.

回答1:

I just had the same issue. What I had to do was:

  • Close Xcode
  • Restart Xcode and made sure I opened the .xcworkspace project file.
  • Ran a Build on the project.

After that I had no more Firebase error messages.



回答2:

In Xcode, Go to Product -> Scheme -> Select New Scheme. Then choose FirebaseCore as Target and Name. Now build the project and then change back to your app target. It works for me in Xcode 9.1



回答3:

Link Binary with Libraries

Build Phases - under Link Binary With Libraries - this is where the magic happens:

It is very likely, your binary is not linked with the Firebase library - hence the header file cannot be found.



回答4:

After updating to XCode 9.4 the problem resolved itself.