不续订订阅:转回时间

时间:2021-07-14 22:45:55

I'm creating an app that will unlock features to users for a limited time. Premium features let's call them. They can buy a subscription for a month, 6 months or a year. These subscriptions would be non-renewing. After a lot of searching the web and finding very different "solutions", I turn to * for what the best should be.

我正在创建一个应用程序,可以在有限的时间内为用户解锁功能。高级功能让我们打电话给他们。他们可以购买一个月,6个月或一年的订阅。这些订阅将不续订。经过大量搜索网络并找到非常不同的“解决方案”后,我转向*以获得最佳效果。

When a subscription is bought, the end date is stored locally on the device until synced via iCloud, because Apple wants you to have this subscription on all your devices. The app checks iCloud to see if the current subscription is still available, shows a nice countdown for the users with days left. But I'm currently encountering a problem. When the user has paid for a month, and changes the date of the device to a year earlier (or something else), it can use the subscription for a year. The countdown now doesn't show 23 days left, but 389.

购买订阅后,结束日期将存储在设备本地,直到通过iCloud同步,因为Apple希望您在所有设备上进行此订阅。该应用程序检查iCloud以查看当前订阅是否仍然可用,为剩下几天的用户显示一个很好的倒计时。但我现在遇到了一个问题。当用户已支付一个月,并将设备的日期更改为一年前(或其他)时,它可以使用该订阅一年。倒计时现在还没有显示23天,但是389。

How can I avoid this? Should I check a certain server to check for the real time and date? What if a user only uses the app in airplane mode?

我怎么能避免这个?我应该检查某个服务器来检查实时和日期吗?如果用户仅在飞行模式下使用该应用程序,该怎么办?

Thx in advance!

Thx提前!

2 个解决方案

#1


0  

You could check standard web-based time-servers to do this. Since I have my own server (as part my in-app purchase mechanisms), I just ask my server for the current time, at the server. I do this every time the app launches, and every time I make a server-call (usually when in-app purchases are done). I then store the time locally (either in the KeyChain or NSUserDefaults, can't remember which!), and use it (and the device time, which ever is later in time) to compute purchase expiries.

您可以检查标准的基于Web的时间服务器来执行此操作。由于我有自己的服务器(作为我的应用内购买机制的一部分),我只是在服务器上询问我的服务器当前时间。我每次启动应用程序时都会执行此操作,并且每次进行服务器调用时(通常在完成应用内购买时)。然后我在本地存储时间(在KeyChain或NSUserDefaults中,不记得哪个!),并使用它(以及设备时间,这是以后的时间)来计算购买到期日。

Of course, this assumes that the user has a network connection when they launch the app. You can only do so much though!

当然,这假设用户在启动应用程序时具有网络连接。你只能做这么多!

#2


-1  

Actually what happening is after successful completion of your InAppPurchase apple will provide you a Transaction Reciept...this transaction reciept is stored in locally . When you want to check the subscription is in active or expired you need to request the storekit with this transaction reciept then the store kit will give you the status .. if the status is 0 then it is in active state . if the status is 21006 then your transaction is Expired. If you want to continue the subscription in antoher device then you need to Restore the transactions there .. after completion of the restoration you will get all the product ids and the transaction reciepts.. you need to store the transaction reciepts there and you need to pass this for the storekit whether it is in active or expired state .. sorry for my poor english..

实际上,在成功完成您的InAppPurchase苹果之后会发生什么事情将为您提供一个事务收据...此事务收据存储在本地。当您想要检查订阅处于活动状态还是已过期状态时,您需要使用此事务收据请求storekit,然后商店工具包将为您提供状态..如果状态为0,则它​​处于活动状态。如果状态为21006,那么您的交易已过期。如果你想继续在antoher设备中订阅,那么你需要恢复那里的交易..完成恢复后,你将获得所有产品ID和交易收据..你需要存储交易收据,你需要将此传递给storekit,无论它处于活动状态还是过期状态...对不起我的英语不好..

#1


0  

You could check standard web-based time-servers to do this. Since I have my own server (as part my in-app purchase mechanisms), I just ask my server for the current time, at the server. I do this every time the app launches, and every time I make a server-call (usually when in-app purchases are done). I then store the time locally (either in the KeyChain or NSUserDefaults, can't remember which!), and use it (and the device time, which ever is later in time) to compute purchase expiries.

您可以检查标准的基于Web的时间服务器来执行此操作。由于我有自己的服务器(作为我的应用内购买机制的一部分),我只是在服务器上询问我的服务器当前时间。我每次启动应用程序时都会执行此操作,并且每次进行服务器调用时(通常在完成应用内购买时)。然后我在本地存储时间(在KeyChain或NSUserDefaults中,不记得哪个!),并使用它(以及设备时间,这是以后的时间)来计算购买到期日。

Of course, this assumes that the user has a network connection when they launch the app. You can only do so much though!

当然,这假设用户在启动应用程序时具有网络连接。你只能做这么多!

#2


-1  

Actually what happening is after successful completion of your InAppPurchase apple will provide you a Transaction Reciept...this transaction reciept is stored in locally . When you want to check the subscription is in active or expired you need to request the storekit with this transaction reciept then the store kit will give you the status .. if the status is 0 then it is in active state . if the status is 21006 then your transaction is Expired. If you want to continue the subscription in antoher device then you need to Restore the transactions there .. after completion of the restoration you will get all the product ids and the transaction reciepts.. you need to store the transaction reciepts there and you need to pass this for the storekit whether it is in active or expired state .. sorry for my poor english..

实际上,在成功完成您的InAppPurchase苹果之后会发生什么事情将为您提供一个事务收据...此事务收据存储在本地。当您想要检查订阅处于活动状态还是已过期状态时,您需要使用此事务收据请求storekit,然后商店工具包将为您提供状态..如果状态为0,则它​​处于活动状态。如果状态为21006,那么您的交易已过期。如果你想继续在antoher设备中订阅,那么你需要恢复那里的交易..完成恢复后,你将获得所有产品ID和交易收据..你需要存储交易收据,你需要将此传递给storekit,无论它处于活动状态还是过期状态...对不起我的英语不好..