13

I've just changed to a new MacBook Pro with the M1 chip and I can't build my app on Xcode. I've already updated all cocoaPods and have already installed the sudo gem cocoa pods install command in the terminal with Rosetta. These are the two errors I get and make the build Fail:

'new' is unavailable: You cannot directly instantiate an STPIssuingCardPin

1
  • You may want to review the answers provided and select one that best answers your query.
    – benomatis
    May 21, 2021 at 7:18

7 Answers 7

18

As it stands in April, 2021...

TL;DR

This is happening since Xcode 12.5, fixed in Stripe 21.3.1, backported to 19.4.1, 17.0.3, 15.0.2, and 14.0.1, according to Pull Request #1766 'Fix compatibility with Xcode 12.5', so the solution for most will be to upgrade Stripe to 21.3.1 or above.

Downgrade Xcode

The simplest alternative, of course, if you need this urgently and want a quick and dirty method, is to downgrade to Xcode 12.4. If you just went ahead and upgraded, like I did, not knowing the potential consequences, you can go to Apple's Download 'more' section and get it from there.

Cocoapods

For those of you who are using Cocoapods (eg. React Native starting version 0.60): note that, with the exception of 21.3.1, none of the other Stripe versions listed above appear to be available on Stripe's Cocoapods changelog page, and, according to Issue #1767 'ver 19.4.1 is still missing from Cocoapods and How about 20.1.2?', it appears they won't be, at least not 19.4.1, which is what I needed, as upgrading Stripe above version 19 caused errors with tipsi-stripe, the library I used to implement card payment in my React Native app.

Stripe's up-and-coming RN library

As a side note, Stripe is about to release its React Native (RN) library, and I have signed up to be a collaborator in its private beta progam, reporting smaller cosmetic bugs mainly. It's already so close to completion, that I could successfully replace tipsi-stripe with it. The Stripe version used in the new library is above the latest fix version, so this error is not appearing there anymore.

Edit May 2021

Stripe's RN library is now in public beta; you might want to give it a try: https://github.com/stripe/stripe-react-native

2
  • 2
    I've succeeded in building a project with Stripe 19.4.1, XCode 12.5. It required to run pod repo update before installing the new Stripe version.
    – Alex Lokk
    May 24, 2021 at 16:35
  • @MihirOza I don’t think I’m using that command at all in my answer, did you maybe want to comment on a different answer?
    – benomatis
    Jun 1, 2021 at 9:23
5

I ran pod update Stripe in the ios folder of my react native project and that resolved the issue by upgrading the Stripe pod from 19.4.0 to 19.4.1.

1
  • This is the best solution if you don't want to move up to iOS 11, thanks !
    – Ben-J
    May 27, 2021 at 8:19
4

Step 1: Install latest version of tipsi-stripe package

"tipsi-stripe": "^9.0.0"

Step 2: Update version Stripe in podfile

pod 'Stripe', '21.4.0'

Step 3: Update platform in podfile and

platform :ios, '11.0'
pod install --repo-update

Step 4: In xcode project -- > Info --> Deployment Target

iOS Deployment Target change to '11.0'

Step 5: Add Empty swift file to your project in Xcode. For example File.swift, after that you should accept modal to create bridge.

step 6: Remove ""$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"", line from LIBRARY_SEARCH_PATHS in project.pbxproj file.

5
  • 1
    legendary answer, this worked like a charm! May 8, 2021 at 18:35
  • @MichealCWallas It's my pleasure
    – Jebasuthan
    May 9, 2021 at 5:11
  • ...though this assumes the OP is using React Native, AND that they're using or willing to implement a new 3rd party library just to fix this issue, none of which was indicated in the original question...
    – benomatis
    May 21, 2021 at 7:01
  • nonetheless, Stripe is now out with their RN library, so no use of using tipsi-stripe anymore
    – benomatis
    May 27, 2021 at 20:22
  • 1
    It's better to give a specific pod name instead of updating all the pods, I was facing some issues after all pod update, pod update Stripe worked for me
    – Mihir Oza
    Jun 2, 2021 at 18:03
3

I just had to change the pod... I had it to a previous version. So specifically check out which version you have in your podfile.

pod 'Stripe', '~> 21.4'
1
  • I guess it depends on what version of Stripe you had before, and if you're using any other dependency that would rely on the Stripe version, because, while fixing this specific issue, the dependency may fail with another error, which it does for me (I use tipsi-stripe for react-native, Stripe's own RN library is still in beta at this time)...
    – benomatis
    Apr 27, 2021 at 8:24
1

Looks like your local copy of the specs repo hasn't been updated in a while. Try running

pod repo update

then change your stripe version to

pod 'Stripe', '~> 21.4'

then pod install

1

Seems to be some stuff related with payment SDK's. If you came here and you are using Paystack you might want to update your Paystack version.

pod 'Paystack', '~> 3.0.16'
1

I was facing a similar issue with stripe pods. My project stopped working when my Xcode updated to 12.5. After a lot of struggle I came up with a simple solution.

  1. Comment the stripe pods. // pod 'Stripe'
  2. Run pod install. This will remove existing stripe pods.
  3. Uncomment stripe pods again. pod 'Stripe'
  4. Run pod install. This will install latest version of stripe pods.

I had to follow this approach since pod update, pod repo update failed endlessly with my project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.