Hello all,
Looking for advice on how and when to initialize StoreKit class.
Right now in our we create StoreKit object every time a user opens the Plans screen. The idea behind this is that the data is always up to date, so for example user cancels a subscription via Settings and then goes to the app, they will see that a plan is cancelled.
But in the docs, Apple says to start to listen for transactions as close as possible to the app launch. Additionally creating StoreKit object multiple times leads a memory leak because of func listenForTransactions() -> Task<Void, Error>
that contains Task.detached
What is the "proper" way to work with StoreKit 2 object? Should I have only one instance of it and have some sort of sync
method to run it every time a user is about to interact with the store or the current implementation is fine?
Thanks