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?
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.
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.
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?"