react-native-purchases: Cannot install pod dependencies for react-native-purchases@4.0.0

Hi! Today I’m trying to upgrade react-native-purchases to version 4.0.0 because I need to use offer codes.

What I did:

  1. Updated version in package.json: "react-native-purchases": "^4.0.0", and in terminal executed npm install.
  2. Went to ios folder and executed pod install.
  3. Getting this error:
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `RNPurchases` depends upon `React-Core`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

What else I tried:

  1. set deployment target to iOS 14.0
  2. removing package-lock.json and node_modules folder before installing dependencies.
  3. removing Podfile.lock file and ios/Pods folder before installing dependencies.
  1. Environment
    1. Platform: iOS
    2. SDK version:
    3. OS version: macOS 11.1
    4. XCode/Android Studio version: 12.3
    5. react-native version 0.61.5

Just to mention, currently we’re using react-native-purchases@3.4.3 with no troubles, thanks in advance 😃

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 18 (5 by maintainers)

Most upvoted comments

Add this line to your Podfile in your ios folder.

Screen Shot 2021-04-11 at 10 36 48 PM

code : pod 'React-Core', :path => '../node_modules/react-native/', :modular_headers => true

Add this line to your Podfile in your ios folder.

Screen Shot 2021-04-11 at 10 36 48 PM

Hi everyone!! Thanks for reporting.

I believe this is related to #191 (the changes were integrated into a different PR, but that’s the gist of it).

The changes were motivated by https://github.com/facebook/react-native/issues/29633#issuecomment-694187116 And the important part of it is image

Could you try adding the following line to your Podfile?

use_modular_headers!

If that raises issues with other dependencies, then maybe try replacing

pod 'RNPurchases', :path => '../node_modules/react-native-purchases', :inhibit_warnings => true

with

pod 'RNPurchases', :path => '../node_modules/react-native-purchases', :inhibit_warnings => true, :modular_headers => false

(i.e.: adding the modular_headers bit)

Let me know if that works!

I am facing with the same issue.

Add this line to your Podfile in your ios folder. Screen Shot 2021-04-11 at 10 36 48 PM

code : pod 'React-Core', :path => '../node_modules/react-native/', :modular_headers => true

Thank You, This Solution saved my day.Worked perfectly

@aboedo Yes, works, thank you!

Same issue