As many Mac developer did to validate Mac app store receipt, I use roddi's code (https://github.com/roddi/ValidateStoreReceipt Thanks!). But recently I found it does not work! The code fails to validate the sample receipt.
Because I just restored my machine from TimeMachine. I thought maybe there was something wrong in my dev environment. I spent a lot of hours to make sure my development provisioning and certificates are correct. But it still fails to validate the sample receipt.
I read Apple's doc carefully (https://developer.apple.com/library/mac/#releasenotes/General/ValidateAppStoreReceipt/_index.html), and find the solution.
roddi's code is still working. You need not change it. (Just need to get the latest version)
Follow these steps (internet required):
- Log out from Mac App Store app.
USE_SAMPLE_RECEIPTflag from your project settings -> Preprocessor Macros.
- Compile your project
- Find this app in Finder
- Double click it in Finder to run. Do not run it in Xcode.
- The OS will ask you to log in with your Apple ID. Do not log in with your real iTunes account. You need to log in with the test account. Find it or create it in the iTunesconnect website.
- The OS will say something like "Your app is broken. Download it in App Store". Ignore this message. If you "Show Package Contents" of this app in Finder, you will see there is a file
_MASReceipt/receipt. The OS installed a development receipt. We will not need the old sample receipt any more. That's why we remove
Done. You can debug your app now.