stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

Xcode15.1 Build issue - underlying Objective-C module 'StripeCore' not found

Open ashokksolanki opened this issue 1 year ago • 5 comments

Describe the bug I was using react-native 0.64.4 version and stripe "@stripe/stripe-react-native": "^0.28.0". It was working fine with Xcode14.2. So for some requirements, we have to upgrade react-native to version 0.69.4 and Xcode15.1 . When I tried to build it failed all the time with the following errors:

underlying Objective-C module 'StripeCore' not found

failed to verify module interface of 'StripeCore' due to the errors above; the textual interface may be broken by project issues or a compiler bug

I tried to upgrade "@stripe/stripe-react-native": "0.37.0" but still getting the same error.

Tried below solutions (The error is the same but referring to another library): https://github.com/apple/swift/issues/64669 https://github.com/apple/swift/issues/64669#issuecomment-1493939553 https://github.com/apple/swift/issues/64669#issuecomment-1515848422

Also tried the post-install hook solution in Podfile as well but doesn't work:

targets_to_skip_verification = [
     'StripeCore',
     'StripeUICore',
     'StripePayments',
     'StripeApplePay',
     'StripeFinancialConnections',
     'StripePaymentsUI',
     'StripePaymentSheet',
     'SwiftProtobuf',
   ]
  post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" 
       # config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
       config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
       if targets_to_skip_verification.include?(target.name)
         puts "Updating OTHER_SWIFT_FLAGS for target #{target.name} to include -no-verify-emitted-module-interface"
         
         # It's very important that the "$(inherited)" part is added, otherwise this will
         # overwrite all other flags and cause a whole separate set of issues
         config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
       end
      __apply_Xcode_12_5_M1_post_install_workaround(installer)
     end
    end
   end
 end

Screenshots Screenshot 2024-03-12 at 3 38 32 PM

Desktop (please complete the following information):

  • OS: macOS Sonoma Version 14.3.1
  • Version: "^0.28.0" (@stripe/stripe-react-native)
  • Xcode: 15.1

Please let me know if you need more information regarding the error.

Thanks!!

ashokksolanki avatar Mar 12 '24 10:03 ashokksolanki

Hm, are you able to reproduce this error in a fresh project using those versions?

charliecruzan-stripe avatar Mar 12 '24 17:03 charliecruzan-stripe

I tried with fresh project it builds successfully but when I add config setting it like:

       config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
       config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'

It broke again with different error message fatal error: module map file '/Users/Administrator/Library/Developer/Xcode/DerivedData/MyProjectName-fhdnsfjpemdvuxhlamfoihlzsjeg/Build/Products/Debug-iphonesimulator/Stripe/Stripe.modulemap' not found

Also tried some workaround for above error but still not able to resolve this error. https://stackoverflow.com/questions/55675694/how-to-fix-cocoapod-modulemap-file-not-found

All these settings are required for my other pods so It needs to work with all of them.

ashokksolanki avatar Mar 18 '24 06:03 ashokksolanki

Describe the bug I was using react-native 0.64.4 version and stripe "@stripe/stripe-react-native": "^0.28.0". It was working fine with Xcode14.2. So for some requirements, we have to upgrade react-native to version 0.69.4 and Xcode15.1 . When I tried to build it failed all the time with the following errors:

underlying Objective-C module 'StripeCore' not found

failed to verify module interface of 'StripeCore' due to the errors above; the textual interface may be broken by project issues or a compiler bug

I tried to upgrade "@stripe/stripe-react-native": "0.37.0" but still getting the same error.

Tried below solutions (The error is the same but referring to another library): apple/swift#64669 apple/swift#64669 (comment) apple/swift#64669 (comment)

Also tried the post-install hook solution in Podfile as well but doesn't work:

targets_to_skip_verification = [
     'StripeCore',
     'StripeUICore',
     'StripePayments',
     'StripeApplePay',
     'StripeFinancialConnections',
     'StripePaymentsUI',
     'StripePaymentSheet',
     'SwiftProtobuf',
   ]
  post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
        config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" 
       # config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
       config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
       if targets_to_skip_verification.include?(target.name)
         puts "Updating OTHER_SWIFT_FLAGS for target #{target.name} to include -no-verify-emitted-module-interface"
         
         # It's very important that the "$(inherited)" part is added, otherwise this will
         # overwrite all other flags and cause a whole separate set of issues
         config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -no-verify-emitted-module-interface'
       end
      __apply_Xcode_12_5_M1_post_install_workaround(installer)
     end
    end
   end
 end

Screenshots Screenshot 2024-03-12 at 3 38 32 PM

Desktop (please complete the following information):

  • OS: macOS Sonoma Version 14.3.1
  • Version: "^0.28.0" (@stripe/stripe-react-native)
  • Xcode: 15.1

Please let me know if you need more information regarding the error.

Thanks!!

i got the same error after installing the "@stripe/stripe-react-native": "^0.37.2", please suggest me the solution if you got the right one as soosn as posible its urgent .thanks

ketan-pcs avatar Apr 19 '24 10:04 ketan-pcs

facing the same issue... tried the above fixes with no luck. any recommendation for the same?

behitesh avatar May 16 '24 08:05 behitesh

This issue can crop up from specific local project settings, so it's hard to say exactly how to resolve it.

I haven't been able to reproduce this on a fresh project using @stripe/stripe-react-native, but if you can please let me know the steps to do that and I'm happy to try and debug!

@ashokksolanki for your other error regarding "'Stripe.modulemap' not found"- make sure you iOS deployment target is up to date and you should re-pod install (maybe clear pod caches beforehand as well)

charliecruzan-stripe avatar May 21 '24 17:05 charliecruzan-stripe