flutter_stripe_payment icon indicating copy to clipboard operation
flutter_stripe_payment copied to clipboard

Build failure on macOS 11.3 and Xcode 12.5

Open medvegy opened this issue 3 years ago • 28 comments

Xcode's output: ↳ .../ios/Pods/Stripe/Stripe/STPPinManagementService.m:51:81: error: 'new' is unavailable: You cannot directly instantiate an STPIssuingCardPin deserializer:[STPIssuingCardPin new] ^ In file included from .../ios/Pods/Stripe/Stripe/STPPinManagementService.m:11: .../ios/Pods/Stripe/Stripe/PublicHeaders/STPIssuingCardPin.h:22:1: note: 'init' has been explicitly marked unavailable here - (instancetype)init attribute((unavailable("You cannot directly instantiate an STPIssuingCardPin"))); ^ .../ios/Pods/Stripe/Stripe/STPPinManagementService.m:101:81: error: 'new' is unavailable: You cannot directly instantiate an STPIssuingCardPin deserializer:[STPIssuingCardPin new] ^ In file included from .../ios/Pods/Stripe/Stripe/STPPinManagementService.m:11: .../ios/Pods/Stripe/Stripe/PublicHeaders/STPIssuingCardPin.h:22:1: note: 'init' has been explicitly marked unavailable here - (instancetype)init attribute((unavailable("You cannot directly instantiate an STPIssuingCardPin"))); ^ 2 errors generated.

Using latest stripe_payment: ^1.0.11

[✓] Flutter (Channel stable, 2.0.5, on macOS 11.3 20E232 darwin-x64, locale en-SK) [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 4.1) [✓] IntelliJ IDEA Ultimate Edition (version 2021.1) [✓] Connected device (3 available)

medvegy avatar Apr 27 '21 10:04 medvegy

Confirm, having the same issue.

sergy-nikolaev avatar Apr 27 '21 10:04 sergy-nikolaev

same issue after updating to Xcode 12.5

parabellumGIT avatar Apr 27 '21 10:04 parabellumGIT

Same here, must be related with Apple Clang Update: https://developer.apple.com/documentation/xcode-release-notes/xcode-12_5-release-notes, it says: Clang now infers the availability of +new from availability annotations on -init methods. Since +new calls [[Foo alloc] init], +new isn’t available unless +init is available. (75884815)

ArnauJorda avatar Apr 27 '21 11:04 ArnauJorda

Same :( It seems it's the Stripe 19.4.0 dependency. Any ideas on how to force update to 19.4.1?

dragosholban avatar Apr 27 '21 12:04 dragosholban

Downgrading to XCODE 12.4 solved the issue

ArnauJorda avatar Apr 27 '21 13:04 ArnauJorda

You can build by forcing the Stripe dependency to be fetched from Stripe GitHub by adding following to the end of your Podspec file in the ios directory inside your flutter project:

pod 'Stripe', :git => 'https://github.com/stripe/stripe-ios.git', :tag => 'v19.4.1'

It's not ideal but looks like that v19.4.1 is not even yet available from Cocoapods directly.

Also I'm not sure if it's required for your project, but I had to enable Non-modular includes within my flutter project build settings. (as mentioned in https://stackoverflow.com/questions/27776497/include-of-non-modular-header-inside-framework-module)

mathatan avatar Apr 27 '21 14:04 mathatan

pod 'Stripe', :git => 'https://github.com/stripe/stripe-ios.git', :tag => 'v19.4.1'

Doesn't seem to work... @mathatan can you please provide more detailed steps?

Thanks in advance

chaesung avatar Apr 28 '21 07:04 chaesung

Same problem to me. I've added the above line at the end of ios/Podfile file but same issue. @mathatan can you provide more details, please?

angelocapone avatar Apr 28 '21 07:04 angelocapone

Have you tried to run pod update within iOS directory? I also noticed that it does not run within simulator for what ever reason.

mathatan avatar Apr 28 '21 08:04 mathatan

tried pod update... but getting same issue on both simulator and physical iPhone.

angelocapone avatar Apr 28 '21 08:04 angelocapone

Depending a bit on which errors you get it might benefit to run flutter clean before build. I personally would still recommend downgrading Xcode to 12.4 but I'll try to add more detailed instructions:

  • Run flutter clean
  • Add the pod 'Stripe', :git => 'https://github.com/stripe/stripe-ios.git', :tag => 'v19.4.1' to the end of your Podspec
  • Run flutter build ios --debug (or what ever you prefer)
  • (depending a bit if your Xcode complains about Non-modular includes; which it should - enable them with the guide explained in https://stackoverflow.com/questions/27776497/include-of-non-modular-header-inside-framework-module)
  • If the build fails (which it might) cd ios and pod update (you might need to do pod repo-update as well)
  • Return to your main project directory and rerun flutter build ios --debug

I'm not using the main branch for this package and I have some additional things in my Podspec, so I'm not fully certain if that could have effects on me being able to make the build. You can try to paste the error from your build, although I cannot promise I'll be able to help. Still though since the non modular import of 3DS breaks simulators I'm downgrading to Xcode 12.4 anyhow. Hopefully this will be resolved soon enough with an actual cocoapods repository version of the 19.4.1 SDK.

mathatan avatar Apr 28 '21 09:04 mathatan

@mathatan I'm going to downgrade XCODE to 12.04

angelocapone avatar Apr 28 '21 10:04 angelocapone

I was able to get the app running with only the pod specified. No need (for now) to downgrade Xcode

pod 'Stripe', :git => 'https://github.com/stripe/stripe-ios.git', :tag => 'v19.4.1'

wilpar avatar Apr 28 '21 14:04 wilpar

My recommendation:

  • don't upgrade Xcode during the first days after release if you work with flutter
  • open up a ticket on the stripe-ios repo and ask them to release the 19.4.1 version :)

jonasbark avatar Apr 28 '21 14:04 jonasbark

Same problem to me. Should i wait or downgrade to 12.4?

Aristotelis1 avatar Apr 29 '21 14:04 Aristotelis1

as there won't be an official release of 19.4.1 it's unlikely this will be fixed soon, so I recommend downgrading to 12.4

PSA: we're working on a brand new plugin that uses the latest dependencies. flutter_stripe_payment will only receive maintenance updates going forward.

jonasbark avatar Apr 29 '21 14:04 jonasbark

as there won't be an official release of 19.4.1 it's unlikely this will be fixed soon, so I recommend downgrading to 12.4

PSA: we're working on a brand new plugin that uses the latest dependencies. flutter_stripe_payment will only receive maintenance updates going forward.

@jonasbark what will be the name of the plugin?

stereotypeCoder avatar Apr 29 '21 18:04 stereotypeCoder

I was finally able to make it work with plugin version 1.0.11 and Xcode 12.5

Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
    end
  end
end

pod 'Stripe', :git => 'https://github.com/stripe/stripe-ios.git', :tag => 'v19.4.1'

In the plugin v1.0.11 -> ios/TPSStripeManager.h change:

- #import <Stripe/Stripe.h>
+ @import Stripe;

Hope that this helps someone, it took me 2 days to get here :) ( No experience in Swift or Object C )

ag84ark avatar May 01 '21 01:05 ag84ark

Thanks for providing that information @ag84ark !

For anyone else: we published the first beta version of the new plugin here: https://github.com/flutter-stripe/flutter_stripe We'd love to get some feedback. Expect 50% more features, 80% fewer existing bugs, and 10(?)% new bugs which we're eager to fix. If you find it useful, feel free to support us on opencollective :)

When I find the time I'll provide some migration instructions for this plugin.

jonasbark avatar May 05 '21 16:05 jonasbark

@jonasbark This is a good new! I will test the new plugin straight away!

angelocapone avatar May 05 '21 17:05 angelocapone

do you have a timeline for google pay in the migration?

iamtheappguy avatar May 13 '21 13:05 iamtheappguy

Do we use flutter_stripe_payment or flutter_stripe or stripe_payment? I'm confusion

ghost avatar May 26 '21 11:05 ghost

Do we use flutter_stripe_payment or flutter_stripe or stripe_payment? I'm confusion

hey used stripe_payment_flutter in the interim and got it all working last week

iamtheappguy avatar May 26 '21 11:05 iamtheappguy

stripe_payment_flutter has the same problems as this package for me. Migrating to flutter_stripe is very painful since the API is completely different and stuff is split between multiple packages and some things no longer exist... I tried the latest version:

publish_to: none

...
flutter_stripe: 
  git: 
    url: https://github.com/flutter-stripe/flutter_stripe.git
    path: packages/stripe
    ref: 659b5288f3d3da5ce1e2fd3ade1bc9fc24d4cf64 # latest master

ghost avatar May 27 '21 10:05 ghost

stripe_payment_flutter has the same problems as this package for me. Migrating to flutter_stripe is very painful since the API is completely different and stuff is split between multiple packages and some things no longer exist... I tried the latest version:

publish_to: none

...
flutter_stripe: 
  git: 
    url: https://github.com/flutter-stripe/flutter_stripe.git
    path: packages/stripe
    ref: 659b5288f3d3da5ce1e2fd3ade1bc9fc24d4cf64 # latest master

I get you but your going to have to make a dicision like I had to, also moving to null safetly is going to end up the same issues I'm seeing

iamtheappguy avatar Jun 03 '21 08:06 iamtheappguy

pod 'Stripe', '~> 21.4'

I tried this and it solved my issue.

fluffy919 avatar Jul 21 '21 15:07 fluffy919

pod 'Stripe', '~> 21.4'

I tried this and it solved my issue.

Would you mind giving more info on this. I can't seem to get that to work.

mclark4386 avatar Jul 26 '21 22:07 mclark4386

same issue :( anyone was able to solve?

hkmsadek avatar Sep 09 '21 08:09 hkmsadek