如何在用户购买应用内购买时移除广告 [英] How to remove ads when user buys in-app purchase

查看:130
本文介绍了如何在用户购买应用内购买时移除广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我希望用户能够支付少量费用来删除广告。我认为最好的方法(应用程序需要保持免费)是通过应用程序内购买。然而,我想知道删除广告的最佳方法以及用户购买升级后如何操作。任何帮助或建议都将非常感谢。

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.

推荐答案

NSUserDefaults中的布尔值似乎是正确的选择。您可以在启动时查看广告,查看是否应展示广告,让应用隐藏或相应地展示广告,并在用户付费时将其设置为适当的值。

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.

已编辑添加:

刚看到开发论坛。如果您特别关注摆弄了NSUserDefaults布尔值的越狱设备上的用户,您可以使用钥匙串存储数据。钥匙串不能以与NSUserDefaults相同的方式进行干预。在该链接上有更多详细信息。

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.

我一般不相信在反盗版方面花费太多精力,但这是一种很容易掩盖自己的方法。这比使用NSUserDefaults要便宜得多。

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.

这篇关于如何在用户购买应用内购买时移除广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆