Stripe iOS SDK - 不兼容的块指针类型发送

How*_*d G 32 ios stripe-payments

Stripe SDK 导致构建失败。具体错误是:

不兼容的块指针类型发送 '__strong STPAPIResponseBlock _Nonnull'(又名 'void (^__strong)(ResponseType _Nullable __strong, NSHTTPURLResponse * _Nullable __strong, NSError * _Nullable __strong)')

到类型'void (^ _Nonnull)(STPSource * _Nullable __strong, NSHTTPURLResponse * _Nullable __strong, NSError * _Nullable __strong)'的参数

它失败的代码是 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];
}
Run Code Online (Sandbox Code Playgroud)

一切正常 - 然后我相信 Xcode 更新了。现在我遇到了这个问题。我尝试从头开始构建一个新的应用程序,除了 Stripe SDK(通过 CocoaPods 安装)之外什么都没有,但失败了。

在我回滚到早期版本的 Xcode 之前 - 任何帮助将不胜感激。

Roh*_*nde 53

XCode 11.4 破坏了 Stripe pod v19.0 并在 v19.0.1 中得到修复
以升级Stripe pod,运行pod update Stripe


Gra*_*rks 16

更新修复:“我们已经向 Cocoapods 发布了 v14.0.1、v15.0.2、v17.0.3 和 v19.0.1,并修复了这个问题。”:https : //github.com/stripe/stripe-ios/issues /1525#issuecomment-604037716

较旧的帖子信息

这在此更改中由 Stripe 修复:https : //github.com/stripe/stripe-ios/pull/1526

如果您坚持使用旧版本的 Stripe,您可以尝试将这两个更改应用到您的本地版本。(更改在https://github.com/stripe/stripe-ios/pull/1526/files)。


小智 8

我这样做了:

Podfile.lock我已将- Stripe (19.0.0)更改 为 - Stripe (19.0.1)然后在 ios 目录的终端中运行“pod update Stripe”。我正在使用颤振,对我来说它奏效了。