Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved external in react-native project using stripe-ios #1732

Closed
djMax opened this issue Dec 13, 2020 · 6 comments
Closed

Unresolved external in react-native project using stripe-ios #1732

djMax opened this issue Dec 13, 2020 · 6 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@djMax
Copy link

djMax commented Dec 13, 2020

Summary

While trying to compile a project using react-native and SDK version 21.1.0, I get this error:

Undefined symbols for architecture x86_64:
"(extension in Foundation):__C.NSScanner.scanUpToString(Swift.String) -> Swift.String?", referenced from:
static Stripe.STPPhoneNumberValidator.formattedRedactedPhoneNumber(for: Swift.String, forCountryCode: Swift.String?) -> Swift.String in libStripe.a(STPPhoneNumberValidator.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Code to reproduce

I have not produced a standalone test yet, but it seems this happens on a vanilla RN project.

iOS version

13, 14

Installation method

CocoaPods

SDK version

21.1.0

Other information

I am trying to use the Stripe SDK from a swift file in a react-native app, which is likely somehow related.

@djMax
Copy link
Author

djMax commented Dec 23, 2020

Any thoughts on this one, or things you'd like me to do to follow up? If I modify this code in STPPhoneNumberValidator:

    if #available(iOS 13.0, *) {
      prefix = scanner.scanUpToString("*") as NSString?
    } else {
      #if !TARGET_OS_MACCATALYST
      scanner.scanUpTo("*", into: &prefix)
      #endif
    }

to essentially remove the use of scanUpToString, it compiles and functions.

    if #available(iOS 13.0, *) {
      scanner.scanUpTo("*", into: &prefix)
    } else {
      #if !TARGET_OS_MACCATALYST
      scanner.scanUpTo("*", into: &prefix)
      #endif
    }

It really does seem like it SHOULD work as is, and perhaps is somehow related to ios version targets (I've tried setting them but that didn't help, but I know there are 50 places it might belong).

@djMax
Copy link
Author

djMax commented Dec 23, 2020

This seems to be the issue, though I can't claim to understand it.

react-native-community/upgrade-support#62 (comment)

@davidme-stripe davidme-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jan 4, 2021
@davidme-stripe
Copy link
Contributor

Thanks for the detailed report! From the linked issue, it looks like React Native may be compiling against the wrong version of the Swift standard library. I'll investigate.

@davidme-stripe
Copy link
Contributor

I still can't reproduce this locally, but it seems like the linked workaround of removing "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"" from the LIBRARY_SEARCH_PATHS build configuration setting is working.

@jp928
Copy link

jp928 commented Mar 25, 2021

@davidme-stripe
I removed all entries in LIBRARY_SEARCH_PATHS

then react-native-linear-gradient failed in build.

Library not found for -lBVLinearGradient

@davidme-stripe
Copy link
Contributor

I believe React Native has fixed this on their end — they shouldn't be specifying Swift 5.0 on newer versions of Xcode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

3 participants