stripe-ios: [BUG] Build errors on Xcode 14 beta 1

Summary

Xcode 14 beta 1 presents a build error in STPApplePayContext.swift l:240

'(any PKPaymentAuthorizationControllerDelegate) -> ((PKPaymentAuthorizationController, PKShippingMethod, @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) -> Void)?' is not convertible to 'pkDidSelectShippingMethodSignature' (aka 'Optional<((PKPaymentAuthorizationControllerDelegate) -> (PKPaymentAuthorizationController, PKShippingMethod, @escaping (PKPaymentRequestShippingMethodUpdate) -> ()) -> ())>')

Code to reproduce

N/A

iOS version

N/A

Installation method

SPM

SDK version

22.4.0

Other information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 19 (4 by maintainers)

Most upvoted comments

Here’s the branch: https://github.com/stripe/stripe-ios/tree/xcode-14-b1

We haven’t had a chance to try everything yet — please don’t release any builds using this branch to the App Store. We’ll merge in these changes before the next minor SDK release.

Quick hotfix, to get rid of the error is to remove casting to pkDidSelectShippingMethodSignature, so the code looks like this:

let pk_didSelectShippingMethod = #selector(
            PKPaymentAuthorizationControllerDelegate.paymentAuthorizationController(
                _:didSelectShippingMethod:handler:))

Dunno how its gonna impact the whole Stripe component functionality, for me thou, it was enough to compile my app and start working on other features.

These changes landed in 22.5.0, so I’ll close this out.

FYI, if you’re running into similar issues in your own projects and need to support multiple Xcode versions, you can use the #if compiler(>=5.7) directive to conditionally compile based on the Swift compiler version.

Thanks for filing this! There are a few issues with compiling on Xcode 14 — we’ll try to have a branch up soon.

I am using Xcode Version 14.2 (14C18) , Expo SDK 45, but nothing works 😞

I am using Xcode Version 14.2 (14C18) , Expo SDK 45, but nothing works 😞

Same here. With Flutter

Im having this issue with Xcode 14.0.1. Fixed it using the fix mentioned previously @gutaker

~Same issue happens with 22.7.0 on Xcode 14 Beta 6~

[Update] After I re-pod install and clean build. It works now.