Reputation: 2044
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");
}];
}
Upvotes: 3
Views: 690
Reputation: 2355
the answer for the new API:
[[MKStoreManager sharedManager]
buyFeature:kFeatureAId
onComplete:^(NSString* purchasedFeature, NSData*purchasedReceipt, NSArray* availableDownloads)
{
NSLog(@"Purchased: %@", purchasedFeature);
}
onCancelled:^
{
NSLog(@"User Cancelled Transaction");
}
];
Upvotes: 3
Reputation: 31045
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;
}
Upvotes: 5