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

sk2 Transaction not annotated to objc #4225

Open
9 of 11 tasks
albilaga opened this issue Aug 27, 2024 · 7 comments
Open
9 of 11 tasks

sk2 Transaction not annotated to objc #4225

albilaga opened this issue Aug 27, 2024 · 7 comments
Labels

Comments

@albilaga
Copy link

Describe the bug
Hello. I am using revenue cat for our iOS app. But the problem is we are using .NET for iOS. We already created our own binding for revenuecat in here https://github.com/thisisthekap/tonestro.maui.revenuecat.ios. But the problem with this approach is basically right now .NET for iOS only can binding for objective C so it need swift that annotated with @objc
Now the sk2Transaction not annotated with @objc as this is different from sk1Transaction. This makes my revenuecat binding can't access to sk2Transaction. Is this intended? I am not sure as I am not native iOS developer. Thank you

  1. Environment
    1. Platform:
    2. SDK version:
    3. StoreKit version:
      • [] StoreKit 1
      • StoreKit 2 (enabled with usesStoreKit2IfAvailable(true))
    4. OS version: 15.0
    5. Xcode version:
    6. Device and/or simulator:
      • Device
      • Simulator
    7. Environment:
      • Sandbox
      • TestFlight
      • Production
    8. How widespread is the issue. Percentage of devices affected.
  2. Debug logs that reproduce the issue.
  1. Steps to reproduce, with a description of expected vs. actual behavior

  2. Other information

  3. Additional context

@albilaga albilaga added the bug label Aug 27, 2024
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@aboedo
Copy link
Member

aboedo commented Aug 27, 2024

Hi @albilaga! 👋
Yeah, StoreKit 2 in general isn't marked @objc since it's a Swift-only framework.
But we have created wrappers around StoreKit 1 and StoreKit 2 objects so that they can be used interchangeably, and those are all marked @objc.

In this case, the equivalent object would be StoreTransaction.

I see that you already have a few APIs that use StoreTransaction, is there anything you needed specifically from the sk2Transaction object?

For what it's worth we've ran into this ourselves in the past, with our wrappers for other platforms (like React-Native, Flutter, Unity, etc), and we usually use StoreTransaction. We're more than happy to help you set up the .NET Maui integration!

@aboedo
Copy link
Member

aboedo commented Aug 27, 2024

I just realized that you were pointing to the property within StoreTransaction, so you're more than aware of that class, sorry for the noise.

As for the property itself, yeah, it's not marked @objc because StoreKit 2 internally isn't Obj-C compatible, and it'd take a significant amount of work to make it so. And in fact that's why we created the StoreTransaction class itself, to make an Obj-C compatible wrapper around the Swift-only SK2 files.

@albilaga
Copy link
Author

Yeah. Is the property not possible to be marked with @objc? Because if not annotated, it means we can't access the property itself.

We are now using Sk1Transaction?.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None) to get PurchaseToken but as far as I am aware, SKPaymentTransaction is deprecated. Is there any way to use this without using sk2? But as I am afraid also, if we can't use sk2 then we will be deprecated moving forward and our binding force us to use sk1 forever.

@aboedo
Copy link
Member

aboedo commented Aug 29, 2024

@albilaga isn't not possible to mark it @objc since it uses a lot of stuff that's Swift-only and not portable. It seems to be an all-around Apple decision to keep it Swift-only unfortunately. StoreTransaction is kind of our best attempt at providing compatibility when needed.

Not only that, but the actual format in SK2 changes drastically - the receipt itself is a JWT (or rather, a set of JWTs), instead of a single base 64 encoded file.

Could you elaborate on how you intend to use it? Are you sending it as a separate thing to your own servers? I'm asking so that we can try to figure out a good solution for you. Typically apps don't use the transaction receipt directly

@mshmoustafa
Copy link
Contributor

I'm going to go ahead and close this stale issue but if you have additional information to share or are still experiencing this issue then please feel free to open it again.

@albilaga
Copy link
Author

albilaga commented Oct 8, 2024

@aboedo the usage is I need to get the PurchaseToken to send to the backend. This is how I do with Sk1Transaction in c#

var purchaseToken = RevenueCatResult.Transaction.Sk1Transaction?.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None) ?? string.Empty;

But it is saying SKPaymentTransaction.TransactionReceipt is obsolete which is why I want to update to SK2 but blocked by this

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

No branches or pull requests

4 participants