I'm getting an error:
Incompatible block pointer types sending 'void (^)(NSString *_strong)' to parameter of type 'void (^)(NSString *_strong, NSData *__strong)'
When I'm implementing MKStoreKit 4.3 in my app on the line of onComplete:
-(IBAction)purchaseFull {
[[MKStoreManager sharedManager] buyFeature:@"productID"
onComplete:^(NSString* purchasedFeature)
{
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
onCancelled:^
{
NSLog(@"User Cancelled Transaction");
}];
}
The API you are trying to use has a method like this:
// use this method to invoke a purchase
- (void) buyFeature: (NSString*) featureId
onComplete: (void (^)(NSString* purchasedFeature,
NSData* purchasedReceipt)) completionBlock
onCancelled: (void (^)(void)) cancelBlock;
but, for the completionBlock parameter, you're passing
^(NSString* purchasedFeature) {
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
which means you are missing the second (NSData*) parameter.
Change your code to something like this:
^(NSString* purchasedFeature, NSData* purchasedReceipt) {
NSLog(@"Purchased: %@", purchasedFeature);
//purchaseBtn.hidden = YES;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With