非续订订阅:从收据中删除? [英] Non-renewing Subscriptions: Removed From Receipt?

查看:18
本文介绍了非续订订阅:从收据中删除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的应用(即将发布)实施应用内购买,并提供对 iOS6 和 iOS7 的支持.我的问题与 iOS6 和 iOS7 之间的非更新订阅机制之间的差异有关,更具体地说是关于如何实现恢复.为了同时适应 iOS6 和 iOS7,我实施了一个服务器端解决方案来启用恢复.我可以选择允许用户创建一个用户名/密码,该用户名/密码可用于不同的设备(如果数据丢失,则为同一设备)进行恢复.我的大部分内容基本上都在工作,但是随着我的测试不断进步,我发现了一些奇怪的东西.

我的 iOS7 恢复过程的初始部分使用 SKReceiptRefreshRequest 刷新应用程序中的收据.当我从 iOS7 设备上删除应用程序时,重新安装(此时没有收据;使用 iExplorer 测试)并进行恢复,SKReceiptRefreshRequest 恢复 10 个购买(我在测试期间为这个特定用户创建的).其中之一是非消耗品,九张收据是不可更新的.这让我很困惑.从 Apple 文档中,我预计只会在刷新的收据中看到非消耗品购买.来自 ),我现在没有收到收据中显示的非续订订阅购买.我只得到非消耗品(我的应用程序只有非更新订阅和非消耗品购买).我至少会在写完这篇文章后立即向 Apple 提交错误报告,他们的文档对预期的行为含糊不清.

到目前为止,我对此的测试包括在 iOS 8.4 和 iOS9 上运行的应用程序(实际上是 9.1 测试版,因为我没有运行生产版本的正确设备),因此看来这是 Apple 的服务器端更改严格来说并不是 iOS/设备端的变化.另请注意,到目前为止,我的所有测试都是在我的应用程序的开发版本中进行的,在应用程序内购买沙箱中也是如此.我很快就会进行生产测试.

12/3/15;更新; 在 Apple 技术支持的提示下,我进行了更多测试.这一次,在运行 iOS9.2 beta 4 (13C75) 的 iPad 上.似乎我们现在通过非续订订阅恢复到正常"状态.也就是说,当我进行恢复时,我再次在收据中看到非续订订阅.

解决方案

请注意,在 App Receipt 中坚持非续订订阅并不能保证您会被 App Store 审阅者接受.成功取决于特定的审阅者.我最近收到了来自 Apple 的这条消息:

<块引用>

我们发现您的应用包含可恢复以前的功能通过输入用户的 Apple ID 购买应用内购买产品和密码.但是,非续订订阅应用内购买不能以这种方式恢复.

修改您的二进制文件以删除此功能是合适的.如果您希望用户能够恢复非更新订阅应用内购买产品,您将需要实施您的自己的恢复机制.

所以最后一次提交应用程序的尝试是不走运的.与前几部不同.

所以现在,我的计划是将 App Receipt 存储在 iCloud Key-Value Storage 上并自动恢复所有购买.它将满足 Apple 的要求:

<块引用>

对于非续订订阅,请使用 iCloud 或您自己的服务器来保留持久的记录.(c) Store Kit 编程指南

这是为这些目的提供的 Apple 代码:

#if USE_ICLOUD_STORAGENSUbiquitousKeyValueStore *storage = [NSUbiquitousKeyValueStore defaultStore];#别的NSUserDefaults *storage = [NSUserDefaults standardUserDefaults];#万一NSData *newReceipt = transaction.transactionReceipt;NSArray *savedReceipts = [storage arrayForKey:@"receipts"];如果(!收据){//存储第一个收据[storage setObject:@[newReceipt] forKey:@"receipts"];} 别的 {//添加另一个收据NSArray *updatedReceipts = [savedReceipts arrayByAddingObject:newReceipt];[storage setObject:updatedReceipts forKey:@"receipts"];}【存储同步】;

I'm implementing in-app purchases for my app (to be released), and providing support for iOS6 and iOS7. My question has to do with differences between non-renewing subscription mechanisms across iOS6 and iOS7, and more specifically about how a restore is implemented. To accommodate both iOS6 and iOS7, I have implemented a server-side solution to enabling a restore. I optionally allow the user to create a username/password that can be used on a different device (or the same device if data is lost) to do a restore. I have most of this basically working but as I've been progressing with my testing, I've found something curious.

The initial part of my restore process for iOS7 uses SKReceiptRefreshRequest to refresh the receipt in the app. When I delete the app from an iOS7 device, re-install (there is no receipt at this point; tested using iExplorer), and do a restore, SKReceiptRefreshRequest restores 10 purchases (that I've created during testing, for this particular user). One of these is a non-consumable, and nine of the receipts are non-renewing. This confuses me. From the Apple docs, I expected only to see non-consumable purchases in the refreshed receipt. From https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html:

"Consumable Products and Non-Renewing Subscriptions: The in-app purchare receipt for a consumable product or a non-renewing subscription is added to the receipt when the purchase is made. It is kept in the receipt until your app finishes that transaction. After that point, it is removed from the receipt the next time the receipt is updated—for example, when the user makes another purchase or if your app explicitly refreshes the receipt."

As relating to non-renewing subscriptions, from https://developer.apple.com/in-app-purchase/In-App-Purchase-Guidelines.pdf:

Use iCloud or your own server to track purchases and allow user to restore purchased subscriptions to all iOS devices owned by a single user

And the following table from (https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html)

Anyone have any insights?

Question: Why does SKReceiptRefreshRequest leave purchases for non-renewing products in the receipt? Is this a bug in the Apple docs or is there something else going on?

2/23/14; Update: I have recently put a bug report into Apple on this. No word back yet. Though, in reality, I don't want this "bug" to go away!

10/20/15; Update: It seems that Apple has actually resolved this "bug". Now, when I do a restore using SKReceiptRefreshRequest (which seems to be Apple's recommended method of doing a restore, see https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html), I now am not getting the non-renewing subscription purchases showing up in the receipt. I am only getting non-consumables (my app has only non-renewing subscriptions and non-consumables purchases). I'm going to submit a bug report to Apple immediately after I write this as at a minimum, their docs are ambiguous on the expected behavior.

So far my testing of this has included my app running on iOS 8.4 and iOS9 (9.1 beta actually as I don't have the right device running the production release), and so it appears this is a server side change with Apple and not strictly speaking an iOS/device side change. Also note that all of my testing so far is on a development build of my app, and so is in the in-app purchase sandbox. I'll be running a production test shortly.

12/3/15; Update; At the prompting of Apple Tech Support, I ran some more tests. This time, on an iPad running iOS9.2 beta 4 (13C75). It seems we're back to "normal" now with non-renewing subscriptions. That is, when I do a restore, I'm seeing non-renewing subscriptions in the receipt again.

解决方案

Be careful, persisting non-renewing subscriptions in App Receipt gives you no guarantee to be accepted by App Store reviewers. The success depends on particular reviewer. I've got this message from Apple recently:

We found that your app includes a feature to restore previously purchased In-App Purchase products by entering the user's Apple ID and password. However, Non-Renewing Subscription In-App Purchases cannot be restored in this manner.

It would be appropriate to revise your binary to remove this feature. If you would like users to be able to restore Non-Renewing Subscription In-App Purchase products, you will need to implement your own restore mechanism.

So the last attempt to submit the app was unlucky. Unlike the previous few.

So now, my plan is to store the App Receipt on iCloud Key-Value Storage and automatically restore all the purchases. It would satisfy Apples requests:

For non-renewing subscriptions, use iCloud or your own server to keep a persistent record. (c) Store Kit Programming Guide

here is the Apple's code provided for these purposes:

#if USE_ICLOUD_STORAGE
NSUbiquitousKeyValueStore *storage = [NSUbiquitousKeyValueStore defaultStore];
#else
NSUserDefaults *storage = [NSUserDefaults standardUserDefaults];
#endif

NSData *newReceipt = transaction.transactionReceipt;
NSArray *savedReceipts = [storage arrayForKey:@"receipts"];
if (!receipts) {
    // Storing the first receipt
    [storage setObject:@[newReceipt] forKey:@"receipts"];
} else {
    // Adding another receipt
    NSArray *updatedReceipts = [savedReceipts arrayByAddingObject:newReceipt];
    [storage setObject:updatedReceipts forKey:@"receipts"];
}

[storage synchronize];

这篇关于非续订订阅:从收据中删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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