iOS应用内购买 - 未收到任何产品 [英] iOS in app purchase - no products received

查看:134
本文介绍了iOS应用内购买 - 未收到任何产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照此处描述的技术将应用内购买添加到我的应用中:

I'm trying to add in-app purchase to my app, following the techniques described here :

iOS 6教程中的应用内购买简介

我通过itunes connect添加了一个产品,其ID设置如下:

I've added a product via itunes connect, which has an id set up like this:

com.mycompany.myapp.myproduct1

捆绑ID(在p列表中指定,也在应用商店中指定)设置为这个:

The bundle id (specified in the p-list and also on the app store) is set up like this:

 com.mycompany.myapp

我正在使用教程IAHelper中的助手类来处理购买功能(相关代码如下所示)。它还有一个子类,主要用于将应用内产品的ID添加到IAHelper的产品ID数组中。

I'm using the helper class from the tutorial, IAHelper, to handle the purchase functionality (relevant code shown below). It also has a subclass which is essentially used to add the id of the in-app product(s) to the IAHelper's array of products ids.

为了测试代码,我创建了一个标有show products的按钮,调用此方法:

In order to test the code, I created a button labeled "show products" which calls this method:

- (IBAction) showProducts {

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productsLoaded:) name:kProductsLoadedNotification object:nil];

    Reachability *reach = [Reachability reachabilityForInternetConnection]; 
    NetworkStatus netStatus = [reach currentReachabilityStatus];    
    if (netStatus == NotReachable) {        
        NSLog(@"No internet connection!");        
    } else {        
        if ([InAppMyAppAPHelper sharedHelper].products == nil) {


            // here's where it calls the helper class method to request the products
            [[InAppMyAppAPHelper sharedHelper] requestProducts];

            self.hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
            _hud.labelText = @"Loading vocabulary...";
            [self performSelector:@selector(timeout:) withObject:nil afterDelay:30.0];

        }        
    }

}

这是从iTunesConnect请求产品的方法,如上所述:

This is the method to request products from iTunesConnect, called above:

- (void)requestProducts {

    self.request = [[[SKProductsRequest alloc] initWithProductIdentifiers:_productIdentifiers] autorelease];
    _request.delegate = self;
    [_request start];

}

(注意前面带有_的变量是指同名的实际变量是每几个合成语句的下划线。)

(Note that the variables preceded by "_" refer to the actual variables of the same name sans the underscore per several synthesize statements)

最后,这是收到响应时得到通知的方法(在IAHelper中):

Finally, this is the method (in IAHelper) that gets notified when the response is received:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {

    NSLog(@"IAHelper, received products results...");   

    self.products = response.products;
    self.request = nil;    

    // Here's the loop to list the products received
    for (id product in _products){
        NSLog(@"IAHelper, received product is: %@", product); 
    }


    [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:_products];    
}

在上面,日志语句显示调用的方法,但循环打印收到的产品没有列出任何东西。

In the above, the log statements show the method is called, but the loop to print the received products doesn't list anything.

因此看起来好像没有在iTunes连接中找到该产品。然而,我在那里设置了一个产品,产品的ID与捆绑ID相同,再加上产品标识符,即

So it looks as if it's not finding the product in iTunes connect. Yet, I've set up a product there, and the id of the product is the same as the bundle id, plus the product identifier, i.e.

bundle id:  com.mycompany.myapp
product id: com.mycompany.myapp.product1

我已经多次检查过了。

I've checked that several times.

我注意到iTunes将广告产品的状态列为准备提交。我需要做一个额外的步骤才能使它可用吗?

I noticed that iTunes lists the status of the ad-in product as "ready to submit". Is there an additional step I need to make to make it available?

总的来说,我做错了什么?

Overall, what am I doing wrong?

推荐答案

我遇到了类似的问题。以下是在阅读技术说明后需要处理/检查的一些步骤Apple:

I run into the exact similar problem. Here are some steps that needs to be adressed/checked after reading this technical note from Apple:


  • 创建唯一的应用ID

  • 为此应用ID启用应用内购买

  • 在您的设备上生成并安装新的配置文件

  • 在Xcode中更新软件包ID和代码签名配置文件

  • 检查您项目的.plist捆绑ID是否与您的应用ID相匹配

  • 填写合同,税金和银行信息。您需要有效合同

  • Create a unique App ID
  • Enable in-app purchasing for this App ID
  • Generate and install a new provisioning profile on your device
  • Update the bundle ID and code signing profile in Xcode
  • Check that your project’s .plist Bundle ID match your App ID
  • Complete your contract, tax, and banking Information. You need a VALID contract

正如官方文档中所提到的,需要提交二进制文件而不提交应用内购买的屏幕截图。我在各种博客上看到了很多关于此问题的误导信息。

As mentioned by the official doc there is NO need to submit binaries neither submit screenshot of in-app purchase. I have seen a lot of missleading info about this on various blogs.

检查完毕后,您已经解决了此列表中的每个问题,请删除您的应用并重新安装。

After checking you have addressed each point in this list, delete your app and reinstall it.

我基本上错过了两件事:正确设置我的ios付费应用程序合同,而我没有在我的设备上安装新的配置文件。可能那是你的问题?

I was basically missing two things on my side: setting up correctly my contract for ios Paid app and i didn't install the new provisioning profile on my device. May be that was your issue?

这篇关于iOS应用内购买 - 未收到任何产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆