Skip to main content

I’ve tried to use `-purchases:shouldPurchasePromoProduct:defermentBlock:` in Objective-C,

But I don’t know how to call it in Objective-C.

 

Please add the way to write it in objc to the docs?

Thanks.

 

https://sdk.revenuecat.com/ios/Protocols/RCPurchasesDelegate.html

Hey @toco! 👋

In Objective-C, you’ll want to be sure your RCPurchases delegate class conforms to RCPurchasesDelegate. If you are using AppDelegate as your RCPurchases delegate, it might look like this in your AppDelegate.h file:

#import "RCPurchases.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCPurchasesDelegate>

 

In AppDelegate.m, your shouldPurchasePromoProduct method might look like this:

- (void)purchases:(RCPurchases *)purchases shouldPurchasePromoProduct:(SKProduct *)product defermentBlock:(RCDeferredPromotionalPurchaseBlock)makeDeferredPurchase {

makeDeferredPurchase(^(SKPaymentTransaction * transaction, RCPurchaserInfo *info, NSError *error, BOOL userCancelled) {
//...
});
}

 


Hi @cody,

Thanks for your reply. It works by using your code :)

Thank you very much!!

 

 


Hi guys,

I’m stuck in the same place as toco trying to integrate RC into an iOS app. It’s a real shame there is no sample app or video walkthrough available for Objective C - would make my life a lot easier - everything is set up on RC and App Store.

If anyone can help in any way, my email is paul.denheyer@gmail.com

A thousand thanks in advance

 

paul


Reply