Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage with Objective-C #84

Closed
MacMark opened this issue Apr 12, 2021 · 3 comments
Closed

Usage with Objective-C #84

MacMark opened this issue Apr 12, 2021 · 3 comments

Comments

@MacMark
Copy link

MacMark commented Apr 12, 2021

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
Copy link
Author

MacMark commented Apr 12, 2021

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
Copy link
Owner

tikhop commented Apr 13, 2021

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 pushed a commit that referenced this issue May 25, 2021
* feature/objc-support:
  Fix typos
  Add extra initialization methods
  Fix initialization methods
  Fix initialization methods
  Fix initialization methods
  Fix localReceipt function
  Fix spm
  Make it possible to use library in objc project (#84)
@tikhop
Copy link
Owner

tikhop commented May 25, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants