Can't find a way to get an Xcode-signed receipt for Mac app

I have been trying to add Xcode’s support for StoreKit testing for my Mac app.

I am able to test the flow of my in-app purchase, with each alert stating [Environment: Xcode], but once I finish a transaction I don’t seem to get an updated receipt in my app bundle’s _MASReceipt folder.

I've tried calling exit(173), but I think that still ends up using the sandbox environment instead of using the Xcode environment. I also tried SKReceiptRefreshRequest, but I always seem to get this error: "Invalid or missing receipt data (0 bytes)".

Any ideas? Am I misunderstanding something?
Thanks

Replies

Testing StoreKit in a macOS app requires Xcode 12 or later running on macOS 11 or later. Are you testing on macOS 10 or 11?
Setting up StoreKit Testing in Xcode > Prepare to Validate Receipts in the Test Environment for details.
Hi,

I run in the same problem. I just updated to macOS Big Sur beta 9 and Xcode 12.2 beta 2 but it is still the same.

Running my macOS app from Xcode with a StoreKit Configuration file, I can make purchases in the Xcode environment but the receipt file is never created in the app bundle.

My app is normally also validating the receipt at launch, but calling exit(173) when the receipt is missing will ask for App Store credentials in the Sandbox environment, not in the Xcode environment.

Is there a way to force a receipt creation/update by Xcode? Should it work without doing anything particular?

Thanks.
Same here. macOS 11 beta 10, Xcode 12.2 beta 3.

Xcode purchases complete and are visible in Debug > StoreKit > Manage Transactions, but the receipt is never updated.

Calls to [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:nil] result in an Apple ID login request.

I do notice the following in system.log:

Code Block
Oct 15 17:30:32 Steves-MacBook-Pro appstoreagent[814]: objc[814]: Class asn1ReceiptToken is implemented in both /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Frameworks/CommerceCore.framework/Versions/A/CommerceCore (0x7fff88733ef0) and /System/Library/PrivateFrameworks/CoreFP.framework/Versions/A/CoreFP (0x10b7cfd90). One of the two will be used. Which one is undefined.
Oct 15 17:30:32 Steves-MacBook-Pro appstoreagent[814]: objc[814]: Class ISPurchaseReceipt is implemented in both /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Frameworks/CommerceCore.framework/Versions/A/CommerceCore (0x7fff88733e78) and /System/Library/PrivateFrameworks/CoreFP.framework/Versions/A/CoreFP (0x10b7cfde0). One of the two will be used. Which one is undefined.

Has anyone found a solution to this?

I'm on Xcode 12.3, and my Mac is on Big Sur.

I've saved StoreKitTestCertificate.cer in my project and I've set the scheme to use the store kit test configuration, but when I call Bundle.main.appStoreReceiptURL there's still no file at that path.

Is there something I'm missing?
I am validating the receipt locally am never able to see the receipts getting updated on my Mac App when making purchases through the Xcode config (StoreKit testing).

I'm surprised that this issue hasn't gained more attention. Is this feature broken?
I can confirm the same issue with a catalyst app (running on macOS). Xcode 12.4 macOS 11.1. Same code is working fine on the iOS simulator targets.

I'm surprised because I thought I would have already tested this but at present the receipt is never delivered.
Still experiencing the same issue, Xcode 12.4, Big Sur 11.2. No xcode receipt, no restoring purchases.