Question

I have an app that I want users to be able to pay a small fee to remove ads from. I figure the best way to do this (the app needs to remain free) is via an in-app purchase. I'm wondering however the best way to go about removing the ads and how to do it once the user has bought the upgrade. Any help or advice would be great thanks.

Was it helpful?

Solution

A boolean in NSUserDefaults seems like the right bet. You can check it on launch to see if ads should display, have the app hide or show ads accordingly, and set it to the appropriate value when the user pays to disable it.

Edited to add:

Just saw this on the dev forums. If you're especially concerned about users on jailbroken devices fiddling with your NSUserDefaults boolean, you could alternatively store the data using keychain. Keychain can't be meddled with in the same way NSUserDefaults can. More details at that link.

I don't generally believe in expending much effort at all on anti-piracy stuff but this is an easy way to cover yourself that doesn't cost terribly much more than using NSUserDefaults.

OTHER TIPS

Another approach would be to record the receipt from the SKPaymentTransaction received on purchase or restore. On subsequent launches you could verify that receipt with the app store in the background, re-enable the ads for next launch if necessary.

Verifying Store Receipts documentation

Whilst I don't think this protects you from pasting in a valid user's receipt from elsewhere, it's more difficult to circumvent than toggling a boolean in the NSUserDefaults. Anyone going to this length is unlikely to pay for your app anyway.

Well, this problem is not iphone limited. You should apply one of the many security algorithm. (I don't know how the purchase is done but i'll make a suggestion) You can for example after purchase make the app send the IMEI to the purchase server that will generate a code that the app will save. Then all the app will check for it to enable/disable the ads. (try to make the code with some hashing algorithm or such)

Please remember that all systems can be cracked so don't try something too complex that will give your real user headache.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top