Stripe iOS SDK - Incompatible block pointer types sending

Viewed 10655

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 Answers

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

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.

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.

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.

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

Related