调用 [SKProductsRequest start] 在 iOS 4.0 上挂起

发布于 2024-10-10 14:18:18 字数 1052 浏览 2 评论 0原文

遇到特定于 iOS 4.0 的 SKProductsRequest 问题。有问题的代码:

- (void)requestProductData
{
    NSSet *productIdentifiers = [NSSet setWithObjects:kLimitedDaysUpgradeProductId, kUnlimitedUpgradeProductId, nil];

    self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];

    self.productsRequest.delegate = self;

    [self.productsRequest start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
     NSLog(@"didReceiveResponse");
}

当调用 [SKProductsRequest start] 时,永远不会调用 productsRequest:didReceiveResponse: 委托方法;此外,整个应用程序挂起并且完全不响应输入。显然,这对于我们的 iOS 4.0 用户来说是一个大问题,因为它不仅会中断付款,还会使应用程序完全无法使用。

其他一些需要注意的事情:这只发生在 iOS 4.0 上; iOS 4.2、3.x 都可以。另外:如果未在 SKProductsRequest 上设置委托(即注释掉“self.productsRequest.delegate = self;”行),则应用程序不会挂起(但当然在这种情况下我们无法获取产品)信息)。此外,问题仍然会重现,所有内容都从 productsRequest:didReceiveResponse: 回调中剥离出来(该方法实际上从未被调用)。最后,如果productIdentifiers NSSet 对象初始化为空集,则不会发生挂起。

还有其他人经历过吗?关于这里可能发生的事情以及我们如何解决这个问题有什么想法/想法吗?

Encountering an issue with SKProductsRequest that is specific to iOS 4.0. The problematic code:

- (void)requestProductData
{
    NSSet *productIdentifiers = [NSSet setWithObjects:kLimitedDaysUpgradeProductId, kUnlimitedUpgradeProductId, nil];

    self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];

    self.productsRequest.delegate = self;

    [self.productsRequest start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
     NSLog(@"didReceiveResponse");
}

When [SKProductsRequest start] is invoked, the productsRequest:didReceiveResponse: delegate method is never invoked; further, the entire app hangs and is completely unresponsive to input. Obviously, this is a huge issue for our iOS 4.0 users as it not only breaks payments but makes the app completely unusable.

Some other things to note: this only happens on iOS 4.0; iOS 4.2, 3.x are fine. Also: if the delegate is not set on the SKProductsRequest (i.e. comment out the line "self.productsRequest.delegate = self;"), the app doesn't hang (but of course in that case we have no way of getting the product info). Also, the problem still reproduces with everything stripped out of the productsRequest:didReceiveResponse: callback (that method never actually gets called). Finally, if the productIdentifiers NSSet object is initialized to an empty set, the hang doesn't occur.

Has anybody else experienced this? Any ideas/thoughts on what could be going on here, and how we might be able to work around this?

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

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

发布评论

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

评论(2

花开浅夏 2024-10-17 14:18:19

您是否尝试过在委托中实现 –request:didFailWithError: ,并查看是否被调用?

have you tried implementing –request:didFailWithError: in your delegate, and seeing if that's getting called?

谜兔 2024-10-17 14:18:19

我今天也遇到了类似的问题。在我发出 SKProductRequest 后,任何委托方法都没有响应。

一切工作正常,我没有对 IAP 代码进行任何更改,但它却崩溃了。

终于发现问题了。如果您自行拒绝该应用程序,则您创建的产品 ID 将失效。我们通过重新提交应用程序并创建新 ID 解决了该问题。此后一切又开始运转。

I had a similar problem to this today. No response to any of the delegate methods after I made a SKProductRequest.

Everything was working fine, I didn't make any changes to the IAP code yet it broke.

Finally found the problem. If you self reject the app, then the product ID's you made become invalid. We resolved it by resubmitting the app and creating new ID's. Everything started to work again after that.

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