iPhone - 无法测试应用内购买
我创建了一个测试帐户,用于应用内购买的沙盒测试。我正在按照以下步骤进行测试
- 注销任何现有帐户
- 打开应用程序并开始获取可用产品列表
开始下载产品的过程
SKPayment *付款 = [SKPayment paymentWithProductIdentifier:productId];
[[SKPaymentQueue defaultQueue] addPayment: payment];
现在理想情况下,此时应该要求我提供用户名/密码。但我没有收到任何提示,并且交易失败(显然是因为我没有登录)
如果我尝试从“设置”->“商店”登录,它会要求我提供信用信息,我确信这是不必要的。
有人可以帮我解决这个问题吗?
谢谢...
I have created a test account for sandbox testing of in-app purchases. I am following these steps to test
- Logged out of any existing accounts
- Open app and start getting list of products available
Start process to download a product
SKPayment *payment = [SKPayment paymentWithProductIdentifier:productId];
[[SKPaymentQueue defaultQueue] addPayment: payment];
Now ideally I should be asked for the user name/pwd at this point. But I am not prompted for anything and the transaction fails (obviously because I am not logged in)
If I try to login from Settings->Store, it asks for my credit info which I'm sure is not necessary.
Can someone please help me with this issue.
Thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好的。这太愚蠢了!但希望有人能从我的错误中吸取教训:)
我正在使用临时分发配置文件测试应用内购买。根据苹果工程师的说法,一旦你这样做,测试帐户就会“停止”成为测试帐户。
应用内购买只能通过在调试模式下通过 XCode 启动您的应用来测试!
更新
这不再是事实了。据说它现在也适用于临时构建。
来源:最近使用临时构建对应用内购买进行的测试。
Ok. This was stupid! But hope someone can learn from my mistakes :)
I was testing the in-app purchase with a adhoc distribution profile. And acc to Apple engineers, as soon as you do that, the test account "stops" being a test account.
In-app purchases CAN ONLY BE TESTED by launching your app via XCode in debug mode!
Update
This is not true any more. It supposedly works fine with adhoc builds as well now.
Source: recent testing of in-app purchases using an adhoc build.
确保您的配置文件中启用了应用内购买
Make sure that you have in-app purchases turned on in your provisioning file
另外,在将 {"receipt-data":...} 发送到验证服务器时,请先使用 Base64 对收据进行编码,然后再将其插入 json 对象。这在任何地方的官方文档中都没有提到:只在几个博客上提到过。
Also, when sending {"receipt-data":...} to verification server do encode the receipt with Base64 before inserting it into json object. This is not mentioned in official docs anywhere: only on a couple of blogs.
我遇到了同样的问题。正如 Oleg 所建议的,问题是 ProductID 无效。在以下位置设置断点
您可能会发现productID 不在response.products 中。发生这种情况时,交易将按照用户取消购买的方式继续进行,因此不会提示登录。
I ran into the same problem. As suggested by Oleg, the issue was that the productID was invalid. Set a break point at
You may find that the productID is not in response.products. When this happen, the transaction will proceed as purchase cancel by user, therefore, never prompt for login.