3

我正在 iOS sdk 中的 inapp-purchase 中工作,我已完成所有步骤,例如在 iTunes 中创建应用程序和在 iTunes connect 上的 manage-inapppurchase 中创建非消耗性应用程序。我的应用程序状态为等待上传,如下面的屏幕截图:

在此处输入图像描述

我的未购买状态已准备好提交

在此处输入图像描述

代码明智的应用程序购买功能已完成,但是,我测试我的应用程序是SKProductsRequest返回未找到产品...!

我的主要应用程序包 id 像com.mycompany.myapp

和我的应用内捆绑 ID,如com.mycompany.paidapp

他们如何测试应用内购买步骤,任何人都可以指导我,请..!

我的示例代码在这里:

- (void)loadStore {

    if ([SKPaymentQueue canMakePayments]) {
        NSLog(@"Parental-controls are disabled");

        request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.mycompany.paidapp"]];
        //request.delegate = self;
        [request setDelegate:self];
        [request start];


    }
    else {
        NSLog(@"Parental-controls are enabled");
    }

}

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

    SKProduct *validProduct = nil;
    int count = [response.products count];
    if (count > 0) 
    {
        validProduct = [response.products objectAtIndex:0];
        NSLog(@"Products found!");
        [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Found..!"];

    } else if (!validProduct) 
    {
        NSLog(@"No products available");
        [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:@"Product Not Found..!"];

    }

}

命令提示符总是在输出下方返回 nslog:

No products available

4

2 回答 2

2

为了测试应用内您可以创建一个 AppID 以及一些应用内内容,在发布应用程序之前您应该检查它。

出于这个原因,我遵循的政策如下: 1. 首先上传一个应用程序。2.添加应用内容。3. 自己拒绝二进制文件。一旦您对应用内测试感到满意,然后将新的二进制文件重新加载到 iTunes。

希望这可以帮助。

于 2012-06-14T13:46:12.527 回答
1

应用程序包名称和 iTunes 应用程序包名称应相同。并且产品必须存在于 iTunes 上。试试下面的代码:

[productIdentifierList addObject:@"CB001"];
[productIdentifierList addObject:@"CB002"];
[productIdentifierList addObject:@"CB003"];

        SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifierList]];
        request.delegate = self;
        [request start];

CB001、CB002 是您在 iTunes 上的产品 ID。

这对我来说可以。

于 2012-06-14T11:37:00.850 回答