iPhone 消耗品的行为类似于非消耗品(已购买...)
我们的应用程序有一个锁定产品列表,这些产品共享相同的消耗品产品 ID(即许多产品的一个消耗品产品 ID)。我们的服务器为我提供了产品列表以及与它们关联的产品 ID:
item name="itemA" iphoneProductId="consumable.test.1"
item name="itemB" iphoneProductId="consumable.test.1"
item name= "itemC" iphoneProductId="consumable.test.1"
我们选择消耗品是因为我们的物品是动态创建的并且需要立即可供用户使用(请不要回复建议我们使用非消耗品,还有很多其他如果我不透露与我们合作的公司的私人详细信息(例如我们为什么使用消耗品),那么这些原因很难解释。这使得我们可以让多种产品共享相同的价格。
当用户购买商品 A(例如)时,该商品就会被解锁。然而,有时,当用户尝试成为 itemB 时,Apple 会返回“您已经购买了此商品,但尚未下载”。点击“确定”立即下载。对于消耗品来说,这种情况绝对不应该发生。我知道我们的系统非常复杂,但就苹果商店套件而言,我们只是再次购买相同的产品。
这可能只是一个沙盒问题吗?由于应用程序尚未发布,我们无法进行实时测试。事实上,整个问题阻碍了发布,因为我们的客户和我们一样担心这个问题。
我遵循了 iPhone 文档和一些应用内购买教程中的相同代码。我看到论坛上很多人似乎都目睹了上面消费品的“已购买”对话框,但没有人得到答复。
请帮忙!谢谢
Our app has a list of locked products that share the same consumable product id (i.e. one consumable product id for many products). Our server provides me with a list of products and the product id associated with them:
item name="itemA" iphoneProductId="consumable.test.1"
item name="itemB" iphoneProductId="consumable.test.1"
item name="itemC" iphoneProductId="consumable.test.1"
We chose consumable because our items are created dynamically and need to be available to the user instantly (please don't reply suggesting that we use non-consumable, there are a lot of other reasons that are too hard to explain without me giving away private details about the company we are working with, as to why we are using consumable). This allows us to have multiple products share the same price.
When the user purchases itemA (for example), the item is unlocked. However, sometimes, when the user then tries to be itemB, Apple return with 'You have already purchased this but it hasn't been downloaded. Tap OK to download it now’. This should surely never happen for a consumable item. I know our system is quite complex but as far as the apple store kit is concerned, are simply just buying the same product again.
Could this just be a sandbox issue? We can't test in live as the app isn't released yet. In fact, this whole problem is holding off the release as our client is as concerned as we are about this problem.
I've followed the same code from the iphone documentation and the few in app purchase tutorials out there. I see that a lot of people on the forums seem to have witnessed the 'already purchased' dialog above for consumable products, but none of them ever get answered.
Please help! Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
问题是你永远无法完成交易。您需要将其从队列中删除。
喜欢:
The problem is that you are never finishing the transaction. You need to remove it from the queue.
Like:
我假设您已调用
-[SKPaymentQueue finishTransaction:]
。在我的脑海中,有几种可能性:
一种技巧是循环浏览多个(10?100?)消耗品的列表,假设当您返回到列表中较早的一个消耗品时,它将完成处理。
另一种解决方案是预先分配大量非消耗品(“product.1”、“product.2”、...、“product.100”),并将具有适当价格的非消耗品分配给服务器上的产品。然后可以在 iTunes Connect 上更改价格,或者根据需要分配其他产品 ID。
I'll assume you've called
-[SKPaymentQueue finishTransaction:]
.Off the top of my head, there are a few possibilities:
A hack is to cycle through a list of several (10? 100?) consumables, assuming that when you get back to one earlier in the list, it will have finished processing.
An alternative solution is to pre-allocate a lot of non-consumables ("product.1", "product.2", ..., "product.100") and assign ones with the appropriate price to products on the server. Changing prices can then be done on iTunes Connect, or by assigning additional product IDs as necessary.
感谢您的快速回复,但我的应用程序似乎正在完成交易等。
我的项目的应用程序内购买类已变得相当复杂,因此我恢复使用测试消费品产品和应用程序内的标准实现来创建一个新的基本项目采购经理/观察员取自此开源:
http:// blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/#idc-cover
出现同样的问题。这是顺序:
1.第一次购买耗材(下面是我打印出来的debug)
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver:SKPaymentTransactionStatePurchased
__MKStoreObserver:完成交易
_MKStoreManager:提供内容
2. Apple 显示“感谢您购买”对话框
3.第二次购买消耗品:
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver:SKPaymentTransactionStatePurchased
__MKStoreObserver:完成交易
_MKStoreManager:提供内容
__MKStoreObserver:SKPaymentTransactionStateFailed
__MKStoreObserver:失败交易
4.苹果显示“您已经购买了这个,但尚未下载。点击“确定”立即下载。[环境:沙盒]”对话框。
在步骤 3 中,交易同时被购买然后失败。你有什么想法吗?
Thanks for your quick response, but my app does seem to be finishing the transaction, etc.
My project's in app purchase classes have become quite complex so I reverted to creating a new basic project with a test consumable product and the standard implementation of in app purchase manager/observer taken from this open source:
http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/#idc-cover
The same problem occurs. This is the order:
1. Buy the consumable product for the first time (below is the debug I printed out)
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver: SKPaymentTransactionStatePurchased
__MKStoreObserver: completeTransaction
_MKStoreManager: provideContent
2. "Thank you for your purchase" dialog is displayed by Apple
3. Buy the consumable product for the second time:
_MKStoreManager: buyFeature:test.consumable.1
__MKStoreObserver: SKPaymentTransactionStatePurchased
__MKStoreObserver: completeTransaction
_MKStoreManager: provideContent
__MKStoreObserver: SKPaymentTransactionStateFailed
__MKStoreObserver: failedTransaction
4. "You've already purchased this but it hasn't been downloaded. Tap OK to download it now. [Environment: Sandbox]" dialog is displayed by apple.
It just doesn't make sense in step 3 that the transaction is both purchased then failed at the same time. Do you have any ideas.
用消耗品代替非消耗品是不值得的,因为苹果会拒绝它。这是发生在我身上的事情:
我也遇到过同样的问题。说明您已经购买了该商品的消息只会偶尔出现一次,而且大多数情况下,如果您购买了很多东西 - 立即一个接一个地购买。
无论如何,我们已将其放在 App Store 中进行审核,并得到以下答案:
……
我们已完成对您的应用内购买的审核,但无法将其发布到 App Store,因为购买类型设置不正确。有关购买和货币指南的信息,请参阅 App Store 审核指南第 11 节 [ https://developer.apple.com/appstore/resources/approval/guidelines.html]。
……
购买一期[杂志]被设置为“消耗品”,但根据产品功能,应将其设置为非消耗品。
…………
您需要使用正确的可购买类型创建新的应用内购买产品。
…………
我希望这可以节省一些人的时间和麻烦。
It is not worth using consumable product for non-cosumable, because Apple will reject it. Here is what happened to me:
I have had the same issue. The message explaining that you have already purchased the item appears only once in a while and mostly if you purchase a lot of things - one after the other immeadiately.
We have put it for review in the App Store anyway and got the following answer:
.....
We have completed the review of your in-app purchase but cannot post it to the App Store because the Purchasability Type is not set correctly. For information on Purchasing and Currency guidelines, please see section 11 of the App Store Review Guidelines [ https://developer.apple.com/appstore/resources/approval/guidelines.html ].
.....
The purchase of a [magazine issue] is set to "consumable", however based on product functionality it should be set as non-consumable instead.
.........
You are required to create a new in-app purchase product with the correct purchasability type.
..........
I hope this saves someone time and headaches.
我也面临着同样的问题。我犯的错误是在发送 finishTransaction 之前取消分配购买。请务必在完成交易后处理交易结果
希望对大家有所帮助。
干杯,
K.
I was facing the same problems. The mistake I did was deallocating the purchase before the finishTransaction was sent. Make sure you handle the transaction result after finishing the transaction
Hope that helps some of you.
Cheers,
K.
无论您是进行新购买还是恢复购买,您都应该在交易之后放置此行 [[SKPaymentQueue defaultQueue] finishTransaction:transaction]。
You should put this line [[SKPaymentQueue defaultQueue] finishTransaction:transaction] after the transaction over whether you are doing fresh purchase or restore purchase.
确保您已在处理请求的控制器上添加此方法。
make sure you have added this method on the controller handling requests.