iOS 应用内 SKProduct 未显示在 iPhone 上,但在模拟器中显示

发布于 2024-12-29 14:28:32 字数 769 浏览 0 评论 0原文

正如标题所示, 当请求 SKProducts 列表并从模拟器运行时,我会得到正确的数组,但是在实际的 iPhone 上,该数组将包含 0 个项目。

NSSet *productSet = [NSSet setWithObject:@"com.somewebsite.someapp.inappproduct"];
SKProductsRequest *pr = [[SKProductsRequest alloc]initWithProductIdentifiers:productSet];
pr.delegate = self;
[pr start];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];


#pragma mark - purchasing
- (void)productsRequest:(SKProductsRequest *)request 
     didReceiveResponse:(SKProductsResponse *)response 
{
    NSLog(@"response = %@",response.products);
    if (response.products.count > 0)
    {
        self.products = response.products;
        [thetable insertSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
    }
}

As the the title suggests,
When requesting a list of SKProducts and running from the simulator, i would get the correct array, however on the actual iphone, the array would contain 0 items.

NSSet *productSet = [NSSet setWithObject:@"com.somewebsite.someapp.inappproduct"];
SKProductsRequest *pr = [[SKProductsRequest alloc]initWithProductIdentifiers:productSet];
pr.delegate = self;
[pr start];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];


#pragma mark - purchasing
- (void)productsRequest:(SKProductsRequest *)request 
     didReceiveResponse:(SKProductsResponse *)response 
{
    NSLog(@"response = %@",response.products);
    if (response.products.count > 0)
    {
        self.products = response.products;
        [thetable insertSections:[NSIndexSet indexSetWithIndex:1] withRowAnimation:UITableViewRowAnimationFade];
    }
}

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

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

发布评论

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

评论(1

挽容 2025-01-05 14:28:32

如果它在模拟器中有效(不知道如何?)但在手机上无效......那么只有当您的设备已越狱时才能解释问题。

http://troybrant.net/blog/2010/ 01/in-app-purchases-a-full-walkthrough/

点击上面的链接并包含无效产品标识符的 NSLog。
如果您收到该日志,该站点会提供发生该情况的各种情况,以便您可以解决问题

If it works in the simulator(don't know how??) but not on the phone..then the problem can only be explained if your device is jailbroken.

http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/

Follow the above link and include the NSLog for Invalid product identifiers..
If you get that log .the site provide the various cases in which it occurs so that you can solve tim

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