stripe-react-native: undefined-symbols-for-architecture-x86_64-on-ios after adding Stripe React Native

Describe the bug I am getting the following error when I run the app in Release mode. undefined-symbols-for-architecture-x86_64-on-ios

That error is documented here but it only fixes the issue in the Debug scheme, not in the Release scheme.

That same fix is also documented here but also fix the issue in the Debug scheme, not the Release scheme.

To Reproduce Steps to reproduce the behavior:

  1. Install a new React Native app
  2. Add Stripe as instructed in the Getting started documentation
  3. Open your project via Xcode, go to project -> build settings, find library search paths and remove all swift related entries such as: $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) and $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME).
  4. Create a new Swift file to the project (File > New > File > Swift), give it any name (e.g. Fix.swift), and create a bridging header when prompted by Xcode.
  5. Run the app in Debug scheme (From your XCode, go to Product > Scheme > Edit Scheme) and choose Run on the left and select Debug in the right pane, do the same for Test
  6. Run the app
  7. The app will build successfully
  8. Repeat step 5 but change Debug to Release then run the app, Build will fail with error undefined-symbols-for-architecture-x86_64-on-ios

Expected behavior The app should build successfully in the Release scheme just like how it is building successfully in the Debug Scheme.

Screenshots Screen Shot 2021-09-20 at 8 00 28 AM

Smartphone (please complete the following information):

  • Device: iPhone 11 Pro Max Simulator
  • OS: 14.5

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15

Most upvoted comments

same issue:

need help

Screenshot 2021-12-29 at 1 01 18 PM

I may have found a solution. The README’s troubleshooting guide wasn’t exactly right in my case.

It said to remove the swift entries from the library search paths.

But I had to remove everything and just leave the inherited value. See screenshot below.

You could also head to your [Project name].pbxproj file and find references to LIBRARY_SEARCH_PATHS and make sure they only have the inherited value in them there.

I have 4 references to LIBRARY_SEARCH_PATHS in the file and I made them all look like this:

LIBRARY_SEARCH_PATHS = "$(inherited)";

and now it works!

Screenshot 2022-07-19 at 10 43 57

❌  Undefined symbols for architecture x86_64
> Symbol: _OBJC_CLASS_$_RCTEventEmitter
> Referenced from: type metadata for stripe_react_native.StripeSdk in StripeSdk-a3ebf5d1e464abf21f2a5d95fac11bff897a445930bcdef1f62aed67246f0d19.o

@gbmahili have you removed those library search paths entries both for debug and release mode? Zrzut ekranu 2021-10-4 o 11 58 06