"Header 'RevenueCat-Swift.h' not found" and "Could not build Objective-C module 'RevenueCat'"

  • 22 June 2022
  • 4 replies

Badge +2

I integrated RevenueCat into an app written in Swift and SwiftUI. It worked all well until now.
All of the sudden Xcode throws these two errors when building the app:


Could not build Objective-C module 'RevenueCat'
At the import RevenueCat statement

Header 'RevenueCat-Swift.h' not found
In a modul.modulemap

The Content of the modulemap is as followed.

framework module RevenueCat {

  umbrella header "RevenueCat-umbrella.h"


  export *

  module * { export * }



module RevenueCat.Swift {

    header "RevenueCat-Swift.h"

    requires objc




The weird thing is, that after rebuilding the app once or twice, the errors disappear.
However, if I try to archive the app, they pop up every time and prevent Xcode from archiving the Build.

I updated to the lates Xcode version some days ago, beside that there's nothing special that could point to the start of the problem.

Any Ideas on that?


Best answer by wildcard 23 June 2022, 02:43

View original

4 replies

Userlevel 4
Badge +8

Hey @wildcard, I think you might be seeing a manifestation of this issue?


If so, in order to work around this, you need to manually add the autogenerated file we committed to the repository RevenueCat-Swift.h to your project, and #import RevenueCat-Swift.h in your bridging header. You can see how we do this in our SPMInstallationTests project.

Userlevel 4
Badge +8

There’s a bit more information in our v4 migration guide under “Known issues”

Badge +2

Hi @Andy thanks for your fast reply.

I’m using CocoaPods and only have one target, so this might come from somewhere else.
Any other ideas?

Badge +2

I solved it. 

Somehow my pods framework ended as a target in my build scheme… 😨
I don’t know when that happened but it was not intended and removing it solved the issue.

However, thanks for your help!