iaphub / react-native-iaphub

The easiest way to implement IAP (In-app purchase) in your React Native app.
https://www.iaphub.com/
MIT License
317 stars 21 forks source link

Error Xcode build: Include non-modular header inside framework module #136

Closed n10ty closed 1 year ago

n10ty commented 1 year ago

Versions: "react-native-iap": "^12.4.14", "react-native-iaphub": "^8.4.0",

It was successfully build before update to versions 5.1.0 -> 8.* Android builds correct ios fails Any suggestions how to fix this?

Screenshot 2023-01-15 at 16 25 16
iaphub commented 1 year ago

What's your version of React Native? We're now supporting the latest versions of react native and I believe this error should happen when using the plugin with an old version of react native.

But you should be able to fix the compilation error if you're not planning to upgrade React Native, you should add the following line in your Podfile (below use_react_native)

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

n10ty commented 1 year ago

@iaphub So I've update react-native from 0.65 to 0.71

    "react-native": "^0.71.1",

I also added the line you mentioned:

target 'renta' do
  use_frameworks! :linkage => :static
  # warn_for_unused_master_specs_repo => false

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"

  config = use_native_modules!

  use_react_native!(:path => config[:reactNativePath])
  pod 'React-Core', :path => '../node_modules/react-native/', :modular_headers => true
end

In react-native-iaphub I set 'allow non-modular includes in framework modulestotrue` as I read suggestion somewhere

Screenshot 2023-01-20 at 23 08 14

I also had both headers in public

Screenshot 2023-01-20 at 23 12 52

And even with all this I'm still getting this errors (I'm doing Xcode "Clean build folder" before build)

Please reopen this issue until I will solve it.

iaphub commented 1 year ago

Ok, since you've updated React native, you do not need to modify your Pod file. Also, you shouldn't have to modify the build settings. Can you try to reset everything back to the default (the pod file and the build settings)? And run pod install in the ios directory of your project.

PS: You can also uninstall the react-native-iap dependency it isn't needed anymore since the v7.0.0 of the library.