xcode 在iOS中实现免费试用期

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14534319/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 02:37:45  来源:igfitidea点击:

Implement free trial period in iOS

iphoneiosxcodeios6trialware

提问by

I am developing an iDevice application.I want to make it such that the User of this application can download this app for free from iTunes but after trial period of 1 week , User will be asked to purchase the app. If the User will not purchase it , then he/she will not be allowed to use the app

我正在开发一个 iDevice 应用程序。我想让这个应用程序的用户可以从 iTunes 免费下载这个应用程序,但在 1 周的试用期后,用户将被要求购买该应用程序。如果用户不购买它,那么他/她将不被允许使用该应用程序

回答by Erik Nedwidek

Use the Keychain to store the date they installed the app. The values your app adds to the keychain persist after your app is uninstalled and can be accessed again upon re-install.

使用钥匙串来存储他们安装应用程序的日期。您的应用程序添加到钥匙串的值在您的应用程序卸载后仍然存在,并且可以在重新安装时再次访问。

https://developer.apple.com/library/ios/#documentation/Security/Reference/keychainservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898-CH4g-SW7

https://developer.apple.com/library/ios/#documentation/Security/Reference/keychainservices/Reference/reference.html#//apple_ref/doc/uid/TP30000898-CH4g-SW7

回答by Gabriele Petronella

One option could be the one proposed by AKV: save the time in the NSUserDefaultsand check it at every launch.

一种选择可能是 AKV 提出的:节省时间NSUserDefaults并在每次启动时检查它。

The weak point is that a user could reset the trial period by reinstalling the app from the AppStore.

弱点是用户可以通过从 AppStore 重新安装应用程序来重置试用期。

A good option would be to use the keychain, which should be persistent across multiple installation of the app.

一个不错的选择是使用钥匙串,它应该在应用程序的多次安装中保持不变。

Alternatively you could to store a unique identifier of the device on your server and check it at every app launch.

或者,您可以在服务器上存储设备的唯一标识符,并在每次应用程序启动时检查它。

The downside of this solution is that it requires an active internet connection, but it will prevent users to easily go around it.

此解决方案的缺点是它需要有效的互联网连接,但它会阻止用户轻松绕过它。

As a final remark it is possible that Apple won't accept an application with such a behaviour. Usually applications are required not to disable functionalities over time, even if some border line cases may apply. The review guidelines may have changed recently, but as far as I know they state clearly

最后,Apple 可能不会接受具有此类行为的应用程序。通常要求应用程序不要随着时间的推移禁用功能,即使可能适用某些边界线情况。指南最近可能有所变化,但据我所知他们清楚地说明

Apps containing "rental" content or services that expire after a limited time will be rejected

包含“租用”内容或服务在有限时间后到期的应用程序将被拒绝

回答by Anoop Vaidya

Save the date time in user defaults.

将日期时间保存在用户默认值中。

On each launch of app go on to check if the dateDiffernce is not more than 30 days. If it is more show a popup as ask user to buy the app. and disable all functionalites.

在每次启动应用程序时,继续检查 dateDifference 是否不超过 30 天。如果更多,则显示一个弹出窗口,要求用户购买该应用程序。并禁用所有功能。

EDIT: In my early days we did a lot of such tweaks for windows, trial ware games and applications. But you lose your saved data with reinstalling the app again. If you still insist not to allow then you can write it in Keychain or some file in documents instead of user-defaults and plist. But for some extent it is not allowed by Apple to have such an application.

编辑:在我早期,我们对 Windows、试用版游戏和应用程序进行了很多此类调整。但是再次重新安装应用程序会丢失保存的数据。如果您仍然坚持不允许,那么您可以将它写在钥匙串或文档中的某个文件中,而不是用户默认值和 plist。但是在某种程度上,Apple 不允许有这样的应用程序。