views:

64

answers:

3

I have an iPhone application that has In App Purchases, and my application also pings my server whenever there is a successful or a failed IAP transaction, but I don't want to count IAPs that I make on my own test devices. How can I tell within the program whether or not I am in a sandboxed user account?

+1  A: 

Could you keep a constant that defines if the app is in debug mode? For instance:

#define kDebug true

Of course, you'd have to remember to flip that to false before submitting an update to Apple.

Another option would be to maintain an array of UDIDs that the app should ignore when IAPs are made.

Ash White
Unfortunately, neither of these solutions are ideal because there are a lot of test devices, and more are added on a fairly regular basis. Also, we want to QA the app in a state as close as possible to what will be released to the App Store.
Jessica
A: 

You create a new configuration for adhoc distribution, if you don't have one already. Select the build flags for that configuration only, and add as other cflags something like -DADHOC=1 and then in your code check #if ADHIC == 1 ... ... #endif

So depending on which configuration you're building, you can then tell.

jer
So, there's no API for this?
Jessica
A: 

If you are running an app tethered to your Mac and running under the debugger to test In App purchases in Sandbox mode, then you can try detecting the debugger using the answer to this question about "Any way to tell if my iPhone app is running under the debugger at runtime?"

hotpaw2