iPhone - 无法测试应用内购买

发布于 2024-08-03 02:38:33 字数 417 浏览 3 评论 0原文

我创建了一个测试帐户,用于应用内购买的沙盒测试。我正在按照以下步骤进行测试

  1. 注销任何现有帐户
  2. 打开应用程序并开始获取可用产品列表
  3. 开始下载产品的过程

    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

  1. Logged out of any existing accounts
  2. Open app and start getting list of products available
  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

给不了的爱 2024-08-10 02:38:33

好的。这太愚蠢了!但希望有人能从我的错误中吸取教训:)
我正在使用临时分发配置文件测试应用内购买。根据苹果工程师的说法,一旦你这样做,测试帐户就会“停止”成为测试帐户。

应用内购买只能通过在调试模式下通过 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.

停顿的约定 2024-08-10 02:38:33

确保您的配置文件中启用了应用内购买

Make sure that you have in-app purchases turned on in your provisioning file

蔚蓝源自深海 2024-08-10 02:38:33
  1. 检查 canMakePayments
  2. 在模拟器中 StoreKit 只是没有响应:您应该在设备上进行测试
  3. 您必须至少将一个观察者添加到 SKPaymentQueue
  4. 尝试首先询问产品列表(除了您已经知道 ProductId 的事实之外);这听起来很愚蠢,但 SK 框架远非完美。

另外,在将 {"receipt-data":...} 发送到验证服务器时,请先使用 Base64 对收据进行编码,然后再将其插入 json 对象。这在任何地方的官方文档中都没有提到:只在几个博客上提到过。

  1. Check canMakePayments
  2. In Simulator the StoreKit just does not respond : you should test on the device
  3. You must have at least one observer added to the SKPaymentQueue
  4. Try to ask for the product list first (besides the fact that you know the productId already); it sounds silly, but SK framework is far from perfect.

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.

长梦不多时 2024-08-10 02:38:33

我遇到了同样的问题。正如 Oleg 所建议的,问题是 ProductID 无效。在以下位置设置断点

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response and check response.products. 

您可能会发现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

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response and check response.products. 

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文