在应用程序购买中发生未知错误

发布于 2024-09-05 07:06:40 字数 420 浏览 4 评论 0原文

我创建了一个具有应用内购买功能的测试应用程序。我能够连接到商店并验证我的产品 ID。然后我使用我的测试用户帐户购买产品。你猜怎么着……它第一次就起作用了。如果我尝试使用测试用户帐户购买另一种产品(相同的产品或不同的产品),则会弹出一个窗口,显示

“发生未知错误”,

并带有“取消”和“重试”选项。如果我重试,我会得到同样的错误。点击“取消”后,我收到错误:

Error Domain=SKErrorDomain Code=0 UserInfo=0x161180“无法连接到 iTunes Store”

有什么想法吗?

更新:

我找到了解决方法。出于某种原因,苹果确实喜欢加拿大的测试用户。我改用美国测试用户,一切正常。

我还发现,在操作系统升级后,我需要从手机上删除该应用程序,并进行干净的构建才能再次正常工作。

I have created a test app that has in app purchasing. I am able to connect to the store and verify my product ID's. I then use my test user account to purchase a product. And guess what... it works... the first time. If I try to use the test user account to buy another product (the same product or a different one) then I get a pop up that says

"An unknown error has occurred"

with a "Cancel" and "Retry" option. If I retry then I get the same error. After hitting cancel I get the error:

Error Domain=SKErrorDomain Code=0 UserInfo=0x161180 "Cannot connect to iTunes Store"

Any ideas?

Update:

I have found a work around. For some reason apple does like Canadian test users. I switched to using US test users and everything worked.

I also found that after an OS upgrade I needed to delete the app off my phone and do a clean build to get things working again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(4

朦胧时间 2024-09-12 07:06:40

因此,这里的问题与您的 iTunes connect 用户是否位于加拿大或美国无关。对于苹果来说,这是一个奇怪的错误。

如果您在 Settings.app 中注销 iTunes 连接用户,然后在 Settings.app 中使用该用户重新登录,则测试用户会因某种原因中毒并永久损坏。您将无法再使用该帐户进行测试。

为了避免在 Settings.app 中注销,但不要重新登录,直到您进入应用程序并且它在购买过程中提示您。

So the issue here doesn't have anything to do with wether or not your iTunes connect user is in Canada or the US. It's kind of a strange bug on Apple's side.

What happens is if you sign-out of an iTunes connect user in Settings.app and then sign back in with that user in Settings.app that test user is somehow poisoned and is broken permanently. You will no longer be able to use that account for testing.

To avoid this sign-out in Settings.app, but don't sign back in until you are inside your application and it prompts you during purchase.

独留℉清风醉 2024-09-12 07:06:40

我遇到了完全相同的问题。我有更多细节,所以让我们深入了解一下!

当我创建新的测试帐户时,第一次购买始终有效。第二次在设备上向我发出一条警报,显示“您已经购买了此产品,但尚未下载...”。此后每次我都会收到“发生未知错误”消息。

我的 NSLogs 提供了更多信息。第一次付款是正常的。但此后的任何付款尝试都会变得很奇怪。在我发送付款请求并使自己成为队列观察者后,我看到两笔交易处于购买状态......奇怪,为什么是两笔?收到错误并点击取消后,我收到发回的两笔处于失败状态的交易。为什么我只发送了一项付款请求,却收到了两次回复?

我使用的是用户应该能够反复购买的消耗品类型。

这对我最后一个月的测试非常有效。它是在过去一周才开始出现这种情况的。这两笔交易似乎来自苹果这边,因为我看不出我的代码可能会导致它。也许苹果对他们的采购系统做了一些改变,但还没有解决问题。

I am having this EXACT same problem. I have some more details so let's get to the bottom of this!

When I create a new tester account, the first purchase always works. The second time gives me an alert that says "You've already purchased this but it hasn't been downloaded..." on the device. Every time after that I get an "Unknown error has occurred" message.

My NSLogs gives some more info. The first payment is normal. But it gets weird for any payment attempt after that. After I send the payment request and make myself a queue observer, I see TWO transactions in the purchasing state... weird, why two? After I get the error and tap cancel, I get two transactions in the failed state sent back. Why would I get two responses when I only sent one payment request?

I am using a consumable product type that the user should be able to purchase over and over again.

This worked perfectly for me the last month of testing. It only started acting like this in the past week. The two transactions seems to be from Apple's side, because I can't see any way my code might be causing it. Perhaps Apple made some changes to their purchasing system and haven't worked out the kinks yet.

抚笙 2024-09-12 07:06:40

就我而言,我在设置 -> 中使用另一个sanbox测试者帐户(我指的是不同的开发者帐户)登录。 iTunes 和应用商店->沙盒帐户

我只是注销,然后再次尝试执行应用内购买。所以它要求我使用另一个沙箱帐户登录。我这样做了并且它按预期工作了!

In my case, I was logged in with another sanbox tester account(of different developer account I mean) in Settings -> iTunes & App Store -> Sandbox Account.

I simply logged out and then tried again to perform the In-App Purchase. And so it asked me to login with another sandbox account. I did so and it worked as it should!

梅倚清风 2024-09-12 07:06:40

消耗品采购也面临同样的问题。如果您的沙箱帐户不是来自美国(可能是因为不是美元货币),您将始终收到错误“发生未知错误”。只需更改国家/地区或创建一个新的沙盒帐户进行测试即可。

Faced with the same issue for consumable purchases. If your sandbox account is not from US(may be because of not $ currency) you will have always the error "Unknown error has occurred". Just change the country or create a new one sandbox account for testing.

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