Skip to main content
Solved

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


Forum|alt.badge.img+3

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

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!

 

View original
Did this post help you find an answer to your question?

4 replies

Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • June 22, 2022

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.


Andy
RevenueCat Staff
Forum|alt.badge.img+8
  • RevenueCat Staff
  • 237 replies
  • June 22, 2022

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/


Forum|alt.badge.img+3
  • Author
  • Helper
  • 2 replies
  • June 22, 2022

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?


Forum|alt.badge.img+3
  • Author
  • Helper
  • 2 replies
  • Answer
  • June 23, 2022

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!

 


Did this post help you find an answer to your question?

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings