R – Detecting with code if your iPhone app is live vs test

in-app-purchaseiphonestorekit

I was wondering if there was a way within an app code to determine if the app is real (in the iTunes store) versus test? The reason is that I have every part of in app purchase resolved. However when verifying the receipt you must send it to either https://buy.itunes.apple.com/verifyReceipt if live or https://sandbox.itunes.apple.com/verifyReceipt if just a test.

Currently I switch the setting prior to submission but I know such an approach can easily fail with a sandbox version being submitted by accident. I would like the code to determine which URL to use.

Best Answer

You could have it set using some #ifdefs and the different build configurations Xcode can create (i.e. debug vs. release vs. distribution).

Related Topic