Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stripe iOS SDK - Incompatible block pointer types sending

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.

like image 639
Howard G Avatar asked Mar 25 '20 01:03

Howard G


2 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

like image 63
Rohit Funde Avatar answered Oct 19 '22 17:10

Rohit Funde


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).

like image 16
Graham Perks Avatar answered Oct 19 '22 17:10

Graham Perks