Wednesday, June 22, 2022

Broken Renewal of MAS Receipts

Lukas Kubanek (FB9789052, tweet):

I started integrating on-device App Store receipt validation into my Mac app, currently not utilizing StoreKit for any kind of in-app purchases. I followed the documentation and employed a check that calls exit(173) if the receipt is invalid. According to the documentation, this should trigger a renewal of the receipt. When I launch the app from Xcode’s build folder for the first time, I get correctly presented with the App Store login window. After entering credentials of a sandbox user configured in App Store Connect, the app quits, relaunches, and then the following dialog appears:

“MyApp” is damaged and can’t be opened. Delete “MyApp” and download it again from the App Store.

This has been broken since around the release of Monterey. This makes it impossible to test the Mac App Store builds of my apps before submitting them to the store. Fortunately, my receipt validation code is already written and working reliably, because I don’t know how I could fully test it without being able to download a receipt.

The mentioned issue doesn’t only occur in the sandbox but also for production apps. When removing the _MASReceipt folder from the production app, it’s supposed to renew the receipt when launched. Instead, the same dialog informing about the damaged app is shown, and the app has to be re-downloaded entirely from the Mac App Store.

Previously:

Update (2022-06-27): Oddly, Apple seems to have fixed the longstanding problem the next day.

2 Comments RSS · Twitter

If it's the same problem as before, the workaround I found was to ignore the directions from Apple on Mac receipt validation and instead follow the iOS directions.

I wrote about it https://ohanaware.com/blog/202151/Mac-App-Store-Receipt-Validation.html

As Michael stated in the update at the bottom of the post, the receipt renewal literally started working again a few days after publishing this post. While it wasn’t officially confirmed by Apple (the feedback is still marked as open on my end), I was able to test all scenarios without any issues. Just in time before rolling out the transition from an upfront purchase to an in-app purchase in my app…

Since writing the feedback cited in the post, I’ve learned that my assumption about receipt renewal in the production environment doesn’t hold true. Apparently, there has to be an outdated (but previously valid) receipt to be renewed. This behavior differs from the sandbox, where you can start without the _MASReceipt folder. This insight comes from Jeff and it has been shared in these Twitter threads:
https://twitter.com/lukaskubanek/status/1541366086586744832
https://twitter.com/lukaskubanek/status/1541366547402350592

Leave a Comment