How to remove ads when user buys in-app purchase [closed]

自作多情 提交于 2019-12-02 16:00:30

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.

mrwalker

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!