我使用下面的代码验证我的Shopify结帐是否成功...但行:
[self.client getCompletionStatusOfCheckout:self.checkout
completion:^(BUYCheckout *checkout, BUYStatus status, NSError *error)
{
给我一个最奇怪的错误:
"不兼容的块指针类型发送' void(^)(BUYCheckout * ___强,BUY状态,NSError * ___强'参数类型' BUYDataCheckoutStatusBlock''
我该如何解决这个问题?这是什么意思?如果您需要更多代码/详细信息,请与我们联系。欢呼声。
·H
@property (nonatomic, strong) BUYClient *client;
的.m
-(void)verifyCheckout{
__block BUYStatus buyStatus = BUYStatusUnknown;
__block BUYCheckout *completedCheckout = self.checkout;
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
do {
[self.client getCompletionStatusOfCheckout:self.checkout completion:^(BUYCheckout *checkout, BUYStatus status, NSError *error) {
completedCheckout = checkout;
buyStatus = status;
dispatch_semaphore_signal(semaphore);
}];
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
if (buyStatus == BUYStatusProcessing) {
[NSThread sleepForTimeInterval:0.5];
} else {
}
} while (completedCheckout.token && buyStatus != BUYStatusFailed && buyStatus != BUYStatusComplete);
}
答案 0 :(得分:0)
Shopify文档说完成块只接受两个参数:
typedef void (^BUYDataCheckoutStatusBlock)(BUYStatus status, NSError *error);
所以行
[self.client getCompletionStatusOfCheckout:self.checkout
completion:^(BUYCheckout *checkout, BUYStatus status, NSError *error)
{
应该是
[self.client getCompletionStatusOfCheckout:self.checkout
completion:^(BUYStatus status, NSError *error)
{