macOS StoreKit2: using AppTransaction.shared triggers user login

278 Views Asked by At

I plan to use the new AppTransaction.shared API in StoreKit2 to find the user's original purchase date and version for my macOS app. However, when testing this by running my app with the Xcode debugger, the app shows up with an App Store login prompt, asking for my login and password, which is undesirable for the user. The WWDC22 presentation "What's New with In-App Purchase" mentions that "StoreKit takes care of automatically updating the App Transaction when necessary", so I assumed this wouldn't be necessary.

I wanted to know if this is just a sandbox quirk, or is the "AppTransaction.shared" API supposed to trigger this prompt for all users, even in production? In that case, is it like the old "Refresh receipt" API where we shouldn't trigger this automatically when a user opens the app, and instead have a button somewhere that triggers the call? Thanks.

2

There are 2 best solutions below

0
Daniel K On

You may want to check your sandbox user is all set up in Settings-> App Store. It should not be prompting unless you use AppTransaction.refresh() which will always prompt the user for a password.

0
Jakob Egger On

As far as I can tell from testing locally signed builds, calling AppTransaction.shared will show a login prompt the first time you call it, despite what the documentation says.

AppTransaction.refresh() on the other hand will show a login prompt every time. So if you call a method in response to a user clicking a button, it should probably be this one.

Unfortunately I have not yet been able to use AppTransaction in production, because AppTransaction.shared and AppTransaction.refresh() seem to always return an error during App Review, so my app was rejected when I tried to use the AppTransaction API.