应用程序内购买response.products为空 [英] In-App Purchase response.products empty

查看:3087
本文介绍了应用程序内购买response.products为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道之前有人问过: iPhone In App Purchase - response.products仍然是空的?

I know it has been asked before: iPhone In App Purchase - response.products are still empty?

但我也在尝试实施应用内购买,我的response.products为空。
我的情况:

but I am also trying to implement an in app purchase and my response.products is empty. My situation:

我上传并拒绝了我的二进制文件。

I uploaded and rejected my binary once.

然后我把状态回到等待再次上传。(这有关系吗?)

But then I put the status back to waiting for upload again.(Does it matter?)

我所有的应用内购买产品的状态是准备提交。

The status of all my in app purchase products are "Ready to Submit".

我的生产用户已退出。测试用户尚未登录。

My production user is signed out. Test user not signed in yet.

-(void) requestProductData{
    SKProductsRequest *productRequest= [[SKProductsRequest alloc] 
                                 initWithProductIdentifiers:[NSSet setWithObjects:
                                                             @"com.mydomain.myapp.Pack1", 
                                                             @"com.mydomain.myapp.Pack2",
                                                             @"com.mydomain.myapp.Pack3",nil]];

productRequest.delegate = self;
[productRequest start];
}

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

NSArray *myProducts = response.products; 

NSLog(@"%d",[myProducts count]);//this prints 0
for(SKProduct * product in myProducts) {
    [products addObject:product];
}
[request autorelease]; 


}

    in my viewdidload:


if([SKPaymentQueue canMakePayments]) {
        NSLog(@"IN-APP:can make payments");
    }
    else {
        NSLog(@"IN-APP:can't make payments");
    }

    /*load transaction history to see if the user already bought some packs*/
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    products = [[NSMutableArray alloc] init];
    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0]; 
    NSString * path = [documentsDirectory stringByAppendingPathComponent: @"history.plist"];
    self.transactionHistory = [NSMutableArray arrayWithContentsOfFile: path];

    if(!transactionHistory) { 
        NSMutableArray *_transactionHistory = [[NSMutableArray alloc] init]; 
        self.transactionHistory = _transactionHistory;
        [_transactionHistory release];
    } 
    //some other initializations here
    [self requestProductData];

for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }
//this returns 3 of my product id's


推荐答案

您的产品错误无效,因此请使用以下主题检查您的配置:
无效的产品ID

You have an invalid product error, so check your configuration with this topic: Invalid Product IDs



  • 您启用了In-App是否购买了您的应用程序ID?

  • 您是否已检查过您的产品已清仓待售?

  • 您是否已提交(并可选择拒绝)您的应用程序二进制文件?

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

  • 您是否为新的App ID生成并安装了新的配置文件?

  • 您是否已使用此新配置文件将项目配置为代码签名?

  • 您是否正在为iPhone OS 3.0或更高版本构建?

  • 您在制作SKProductRequest时是否使用完整的产品ID?

  • 您将产品添加到iTunes Connect后等了几个小时?

  • 您的银行详细信息是否在iTunes Connect上有效?

  • 您是否尝试从设备中删除该应用并重新安装?

  • 您的设备是否已越狱?如果是这样,你需要恢复IAP的越狱才能工作。

  • Have you enabled In-App Purchases for your App ID?
  • Have you checked Cleared for Sale for your product?
  • Have you submitted (and optionally rejected) your application binary?
  • Does your project’s .plist Bundle ID match your App ID?
  • Have you generated and installed a new provisioning profile for the new App ID?
  • Have you configured your project to code sign using this new provisioning profile?
  • Are you building for iPhone OS 3.0 or above?
  • Are you using the full product ID when when making an SKProductRequest?
  • Have you waited several hours since adding your product to iTunes Connect?
  • Are your bank details active on iTunes Connect?
  • Have you tried deleting the app from your device and reinstalling?
  • Is your device jailbroken? If so, you need to revert the jailbreak for IAP to work.

这篇关于应用程序内购买response.products为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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