tags:

views:

420

answers:

2

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.

+5  A: 

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.

Danilo Campos
A: 

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.

feal87
I can't say I agree. In fact, this is not only overkill, it's a bad idea. First of all, there's no API for an iPhone app to get the IMEI -- all you can get is the UDID. Second, the user may very well replace their handset at some point. The iPhone SDK's StoreKit API provides mechanisms to reauthorize the unlocked feature on replacement hardware. Reinventing the wheel for such a simple, unlockable feature doesn't seem like the right call.
Danilo Campos