capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 74 forks source link

Type errors in ios build #31

Closed LinnaeK closed 3 years ago

LinnaeK commented 3 years ago

I have a quasar based (Vue.js) project with which we are using capacitor and stripe. I was very excited to find your plugin as I have not been able to successfully test apple pay on a mobile device due to apple's security restrictions. Unfortunately after I installed the plugin into the project following your installation guide (https://capacitor-community.github.io/stripe/installation/) all ios builds fail. In the terminal I am getting:

` BUILD FAILED

The following build commands failed: CompileSwift normal arm64 CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (2 failures)

App · ⚠️ Command "xcrun" failed with exit code: 65

⚠️ xcodebuild command failed!`

And if I look at the files in xcode, I see 36 errors during build time, the majority (if not all of them) are listed as type errors. E.g. Cannot find type 'PKPaymentAuthorizationViewControllerDelegate' in scope, Cannot find type 'PKPayment' in scope, etc.

Can you please clarify whether the ios plugin is complete, and if so how to resolve these errors?

Thank you!

ihadeed commented 3 years ago

I think I've experienced this bug recently. IIRC there was another error message about "Stripe3DS2.xcframework" not being present.

The fix was to upgrade Cocoapods to latest version and re-installing the project pods (or npx cap update ios).

bryce13950 commented 3 years ago

Further information... I had the issue that @ihadeed is referring to, which resolved with sudo gem install cocoapods, and then the command that was indicated. After that I then received @LinnaeK exact issue.

bryce13950 commented 3 years ago

After further investigation, it seems that this is an issue with Apple Pay. https://developer.apple.com/documentation/passkit/pkpaymentauthorizationresult I have not set up Apple Pay yet, so I will go down that road, and see if the original issue is still an issue. The two errors mentioned in this thread do indeed seem to be unrelated.

bryce13950 commented 3 years ago

OK, so even further investigation! it seems like there is an incompatibility with the newest version of the stripe library (21.0.1) It seems like there simply needs to be some updates done to the library to make it compatible i.e. change enums like typeCard to card etc. For whatever reason, the capacitor update is not respecting the major version number declared in the pod file, which is thus causing it to write out a pod lock file that has the incompatible version within it.

@LinnaeK to get your app to compile simply bump the version number down from 21.0.1 to 20.1.1 in the pod lock file in ios/App then run pod install from the root of the Xcode project.

@ihadeed If you would like some help updating the plugin to run against 21.* let me know. It all seems pretty self explanatory, and I could knock it out tomorrow.

ihadeed commented 3 years ago

Thanks @bryce13950

Just checked and yeah it seems that 20.1.1 compiles fine with latest X Code 12, Cocoapods 1.10.0, and macOS 11.0.1.

I'll push a patch now to lock the version to 20.1.1 until the plugin is updated to use the 21.* syntax.

If you work on updating the plugin, please create a draft PR in case I have some time to help (I can collab on the same branch).

ihadeed commented 3 years ago

@capacitor-community/stripe@1.0.4 is now published and has the fix included.