32
votes

The Stripe SDK is causing a build a failure. The specific error is:

Incompatible block pointer types sending '__strong STPAPIResponseBlock _Nonnull' (aka 'void (^__strong)(ResponseType _Nullable __strong, NSHTTPURLResponse * _Nullable __strong, NSError * _Nullable __strong)')

to parameter of type 'void (^ _Nonnull)(STPSource * _Nullable __strong, NSHTTPURLResponse * _Nullable __strong, NSError * _Nullable __strong)'

The code it is failing on is the following within STPAPIClient.m...

- (NSURLSessionDataTask *)retrieveSourceWithId:(NSString *)identifier clientSecret:(NSString *)secret responseCompletion:(STPAPIResponseBlock)completion {
    NSString *endpoint = [NSString stringWithFormat:@"%@/%@", APIEndpointSources, identifier];
    NSDictionary *parameters = @{@"client_secret": secret};
    return [STPAPIRequest<STPSource *> getWithAPIClient:self
                                               endpoint:endpoint
                                             parameters:parameters
                                           deserializer:[STPSource new]
                                             completion:completion];
}

Everything was working fine - and then I believe Xcode updated. Now I get this problem. I tried building a new app from scratch with nothing in it other then the Stripe SDK (installed via CocoaPods) and that failed to.

Before I rollback to an earlier version of Xcode - any help would be much appreciated.

7
I should have mentioned - I'm running XCode 11.4 and targeting iOS 13.4 - Howard G
FYI you can edit a question to include more information instead of adding comments. - Westy92

7 Answers

53
votes

XCode 11.4 broke the stripe pod v19.0 and it got fixed in v19.0.1
to upgrade the stripe pod, run pod update Stripe

16
votes

Update with fixes: "We've released v14.0.1, v15.0.2, v17.0.3, and v19.0.1 to Cocoapods with fixes for this issue.": https://github.com/stripe/stripe-ios/issues/1525#issuecomment-604037716

Older post info:

This is fixed by Stripe in this change: https://github.com/stripe/stripe-ios/pull/1526

If you're stuck on an older version of Stripe, you can try applying the two changes to your local version. (Changes at https://github.com/stripe/stripe-ios/pull/1526/files).

8
votes

I did this:

in Podfile.lock i have changed - Stripe (19.0.0) to - Stripe (19.0.1) and then in terminal in the directory of ios ran "pod update Stripe". I'm using flutter and for me it worked.

1
votes

Also ran into this, but am on the v14 version of the stripe pod. The only option I can find for people in my position is to revert back to xcode 11.3.1.

0
votes

You can set your stripe SDK to Version 19.0.1 to fix this issue.

pod 'Stripe', '~> 19.0.1'

OR else update your stripe pod to latest version by pod update command.

0
votes

I had this problem too, it was xcode 11.4 update and i was running stripe v15.0.1.

I´ve just updated my stripe version to v15.0.2. Depending your version you can check this: https://github.com/stripe/stripe-ios/issues/1525#issuecomment-604037716

0
votes

I set my Stripe SDK to version 19.0.1 in my Pod file and ran the pod update command