Ios 如何修复不兼容的块指针类型发送错误?
由于xcode 11.5中的不兼容块指针类型发送错误,生成失败Ios 如何修复不兼容的块指针类型发送错误?,ios,objective-c,swift,xcode11,Ios,Objective C,Swift,Xcode11,由于xcode 11.5中的不兼容块指针类型发送错误,生成失败 - (NSURLSessionDataTask *)retrieveSourceWithId:(NSString *)identifier clientSecret:(NSString *)secret responseCompletion:(STPAPIResponseBlock)completion { NSString *endpoint = [NSString stringWithFormat:@
- (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];
}
-(NSURLSessionDataTask*)检索资源ID:(NSString*)标识符
clientSecret:(NSString*)secret
响应完成:(STPAPIResponseBlock)完成{
NSString*端点=[NSString stringWithFormat:@“%@/%@”,
apidentpointsources,identifier];
NSDictionary*参数=@{@“客户机_secret”:secret};
return[STPAPIRequest getWithAPIClient:self
端点:端点
参数:参数
反序列化程序:[STPSource new]
完成:完成];
}
观察错误中描述的两种类型的块之间的差异 你正在发送
STPAPIResponseBlock
aka^(ResponseType,NSHTTPURLResponse,NSError)
预期类型为:
^(STPSource、NSHTTPURLResponse、NSError)
STPAPIResponseBlock
的第一个参数不兼容
然而,这似乎是一个错误
确认您拥有
14.0.1
或更高版本的库。这可能会解决问题。objc不是最新版本,但您似乎试图将STPAPIResponseBlock
传递给不匹配的函数参数STAPIResponseBlock
可能是专用块的类型别名,GetWithApicClient
方法希望为completion
参数使用另一种类型的块问题是由于StripeAPI,因为Xcode 11的构建成功。