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

Questions: Can I use StoreKit 2 API? #16893

Open
Harween64 opened this issue Nov 25, 2022 · 5 comments
Open

Questions: Can I use StoreKit 2 API? #16893

Harween64 opened this issue Nov 25, 2022 · 5 comments
Labels
missing-api-bindings requires-swift An issue that requires swift support to fix
Milestone

Comments

@Harween64
Copy link

Hello all,

Everything is in the title.

Is it possible to use StoreKit 2 API with Xamarin iOS or .Net 7?
If yes, how?
If no, is there any plan to enable this in the future?

Thank you

@rolfbjarne rolfbjarne added the requires-swift An issue that requires swift support to fix label Jan 19, 2023
@rolfbjarne rolfbjarne added this to the Future milestone Jan 19, 2023
@rolfbjarne
Copy link
Member

It looks like the StoreKit 2 API is Swift-only, and unfortunately we don't support Swift-only API yet.

@dalexsoto
Copy link
Member

As of today, the only way to use a swift library is via a proxy library, the general idea is described here https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-swift/ basically you would need to expose the StoreKit 2 Apis you need via a Swift glue layer that exposes the method via the swift bridge header and then creating a C# binding project for this.

@thefex
Copy link

thefex commented Jul 31, 2023

Like @dalexsoto said.

Take a look at my project, you can base on it and extend it based on your needs:
https://github.com/thefex/Xamarin.iOS.StoreKit2Sample

There is implementation of one method responsible of showing manage storekit subscriptions view.

You just add appropriate methods in Swift (via Xcode) marked with @objc attribute, then follow Readme - howto build xcframework, build bindings library and consume via nuget.

Take a note that asynchronous swift methods are crashing on runtime due to the following issue:
#18562
on simulator (it works on real device)

@taublast
Copy link

taublast commented May 19, 2024

@thefex Thanks, this helped me to create a wrapper for some of their new storekit api https://github.com/taublast/AppoMobi.Xamarin.ExternalPurchaseLink, one could use that as another example too, iPhone and simulator are both supported. It's for a legacy Xamarin project while MAUI .Net version might be easier to bind.

@Harween64
Copy link
Author

@thefex ans @taublast Thanks ! I will take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing-api-bindings requires-swift An issue that requires swift support to fix
Projects
None yet
Development

No branches or pull requests

5 participants