ProductsRequest didReceiveResponse返回无效产品

时间:2014-03-25 10:28:05

标签: ios in-app-purchase xcode5 skproduct

我知道类似的问题被多次询问过,但是非中的问题对我有用。

我尝试在我的应用中构建应用内购买。

我创建了新的应用ID:

enter image description here

我把它放在我的应用程序包中:

enter image description here

我创建了新产品(自动更新),我破解了Cleared for Sale,我上传了图片,因此产品处于(橙色圆圈)等待审核状态。

enter image description here

我在Xcode中使用正确的配置文件构建应用程序:

enter image description here

我等了24个多小时。

我也上传了二进制文件并停止了这个过程,但之后我才开始阅读,现在没有必要了。

我的代码是:

#define kBuyCubeProductIdentifier @"BIM02_APP01"
....
if ([SKPaymentQueue canMakePayments]) {
    NSLog(@"User can make payments");


    NSLog(@"identifier : %@", kBuyCubeProductIdentifier);
    request = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithObject:kBuyCubeProductIdentifier]];
    request.delegate = self;
    [request start];
}
else{
    NSLog(@"User cannot make payments due to parental controls");
} 
....

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

    NSLog(@"products invalid : %@", response.invalidProductIdentifiers);

    SKProduct * validProduct = nil;
    int count = response.products.count;
    if (count > 0) {
        validProduct = [response.products objectAtIndex:0];
        [self purchase:validProduct];
        NSLog(@"Products Available!");

    }
    else if (!validProduct)
    {
        NSLog(@"No products available");
    }
}

我在日志中得到回应:

User can make payments
identifier ; BIM02_APP01
products invalid : (
    "BIM02_APP01"
)
No products available

任何人都可以帮助我,因为我现在已经在这里呆了两天了,我无法弄清楚。

2 个答案:

答案 0 :(得分:4)

确保您满足以下所有条件

1.您是否为应用程序ID启用了应用程序内购买?

2.您是否检查过您的产品已售出?

3.您是否已提交(并可选择拒绝)您的申请二进制文件?

4.您项目的.plist捆绑ID是否与您的App ID匹配?

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

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

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

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

9.自从将产品添加到iTunes Connect后,您还等了几个小时?

10.您的银行详细信息在iTunes Connect上有效吗? (通过马克)

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

如果你对这些问题中的任何一个回答“否”,那就是你的问题。

同时检查此link。希望这将清除您为什么会收到无效产品的最大疑问。

答案 1 :(得分:0)

方法response.products最多返回0个产品。我估计有10%的时间我会得到正确的价格。这在应用程序的市场和单个项目页面上是一致的。

我的委托方法是......

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

这个SO帖子提到了这个11点清单[(ProductsRequest didReceiveResponse returns invalid products但我找不到&我认为这不适用于间歇性行为...

银行详细信息真的可能是导致此问题的原因。我的APPLE ID开发者帐户大约在24小时前更新了....?