用户购买内购时如何去除广告

发布于 2024-08-16 04:41:12 字数 1435 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

风吹过旳痕迹 2024-08-23 04:41:12

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

编辑添加:

刚刚在开发论坛上看到这个。如果您特别担心越狱设备上的用户会摆弄您的 NSUserDefaults 布尔值,您也可以使用钥匙串存储数据。钥匙串不能像 NSUserDefaults 那样被干预。更多详细信息请参见该链接。

我一般不认为需要在反盗版方面花费太多精力,但这是一种简单的保护自己的方法,而且比使用 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.

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.

方圜几里 2024-08-23 04:41:12

另一种方法是记录购买或恢复时收到的 SKPaymentTransaction 的收据。在后续启动时,您可以在后台通过应用程序商店验证收据,如有必要,可以在下次启动时重新启用广告。

验证商店收据文档

虽然我不认为这可以保护您从其他地方粘贴有效的用户收据,但它比切换 NSUserDefaults 中的布尔值更难规避。无论如何,任何人都不太可能为你的应用程序付费。

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.

叶落知秋 2024-08-23 04:41:12

嗯,这个问题不限于iphone。您应该应用众多安全算法之一。
(我不知道如何购买,但我会提出建议)
例如,您可以在购买后让应用程序将 IMEI 发送到购买服务器,该服务器将生成应用程序将保存的代码。然后所有应用程序都会检查它以启用/禁用广告。 (尝试使用某种哈希算法或类似算法来编写代码)

请记住,所有系统都可能被破解,因此不要尝试过于复杂的东西,这会让真正的用户感到头疼。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文