tikhop / TPInAppReceipt

Reading and Validating In App Purchase Receipt Locally.
MIT License
631 stars 93 forks source link

Usage with Objective-C #84

Closed MacMark closed 3 years ago

MacMark commented 3 years ago

Hi all,

i try to use TPInAppReceipt with an Objective-C project via CocoaPods. The @import TPInAppReceipt; works but the compiler does not recognize/see the classes like InAppReceipt.

Because the TPInAppReceipt classes look public it should be possible. I'm probably doing it wrong. Can you please give me a hint?

Kind regards, Markus

MacMark commented 3 years ago

I see the TPInAppReceipt uses structs. Structs cannot be accessed by Objective-C as far as i know. Could you provide a small wrapper class that exposes "receipt.activeAutoRenewableSubscriptionPurchases"? :-) Basically i'm looking just for a means to read the expiration date for an auto renewable subscription from the receipt.

tikhop commented 3 years ago

Hi @MacMark,

The best I can do for now is to suggest to create an umbrella/wrapper file and expose properties you're looking for. I've created an example that you can improve by adding an extra functionality.

https://gist.github.com/tikhop/7d1215bbcea7fe8a3be3ce5ef25e15ee

Best, Pavel

tikhop commented 3 years ago

Hi @MacMark,

Just released a new version 3.2.0 and now it works in objc projects.

If you are using cocoapods just do:

pod 'TPInAppReceipt/Objc'

Let me know if you have any questions or need some extra functionality.