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
7
Answers
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.
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
Step 1: Install latest version of
tipsi-stripe
packageStep 2: Update version
Stripe
in podfileStep 3: Update platform in
podfile
andStep 4: In xcode
project -- > Info --> Deployment Target
Step 5: Add Empty swift file to your project in
Xcode
. For exampleFile.swift
, after that you should accept modal to create bridge.step 6: Remove
""$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"",
line fromLIBRARY_SEARCH_PATHS
inproject.pbxproj
file.I ran
pod update Stripe
in theios
folder of my react native project and that resolved the issue by upgrading the Stripe pod from 19.4.0 to 19.4.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
then
pod install
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.
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.
I had to follow this approach since pod update, pod repo update failed endlessly with my project.