我收到了一个错误:
不兼容的块指针类型发送'void(^)(NSString * _ strong)'到'void(^)类型的参数(NSString * _strong,NSData * __ strong)'
当我在我的应用中实现MKStoreKit 4.3
on onComplete:
-(IBAction)purchaseFull {
[[MKStoreManager sharedManager] buyFeature:@"productID"
onComplete:^(NSString* purchasedFeature)
{
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
onCancelled:^
{
NSLog(@"User Cancelled Transaction");
}];
}
答案 0 :(得分:5)
API you are trying to use有这样的方法:
// use this method to invoke a purchase
- (void) buyFeature: (NSString*) featureId
onComplete: (void (^)(NSString* purchasedFeature,
NSData* purchasedReceipt)) completionBlock
onCancelled: (void (^)(void)) cancelBlock;
但是,对于completionBlock
参数,您正在传递
^(NSString* purchasedFeature) {
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
表示您缺少第二个(NSData*
)参数。
将您的代码更改为以下内容:
^(NSString* purchasedFeature, NSData* purchasedReceipt) {
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
答案 1 :(得分:3)
新API的答案:
[[MKStoreManager sharedManager]
buyFeature:kFeatureAId
onComplete:^(NSString* purchasedFeature, NSData*purchasedReceipt, NSArray* availableDownloads)
{
NSLog(@"Purchased: %@", purchasedFeature);
}
onCancelled:^
{
NSLog(@"User Cancelled Transaction");
}
];