Skip to main content
Solved

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

  • 22 June 2022
  • 4 replies
  • 1381 views

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?

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

https://github.com/apple/swift/issues/57480

 

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.


There’s a bit more information in our v4 migration guide under “Known issues” https://revenuecat.github.io/purchases-ios-docs/4.6.1/documentation/revenuecat/v4_api_migration_guide/


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?


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!

 


Reply