iPhone - 应用内购买问题

Sat*_*yam 2 iphone in-app-purchase

我已经通过应用内购买创建了iPhone应用.现在,我正处于测试阶段.

我创建了配置文件com.satyam.testapp在iTunes中连接我创建了应用程序并上传了图像,屏幕截图,desscription等.我还创建了两个用于应用内购买的ID.一个是com.satyam.testapp.book1,另一个是com.satyam.testapp.book5

我还创建了测试帐户,用于验证我的应用内购买.

使用com.stayam.testapp我创建了开发人员测试配置文件,并在我开发的应用程序中使用它.

我在iphone中登出了itunes app store帐户.

现在我开始在我的iphone上运行我的应用程序.它说没有物品可以购买.但它甚至没有要求我输入我要输入测试帐户用户名和密码的凭据.....

怎么调试呢?

这是我的代表:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *myProduct = [[NSArray alloc] initWithArray:response.products];
    for(int i=0;i<[myProduct count];i++)        
    {
        SKProduct *product = [myProduct objectAtIndex:i];
        NSLog(@"Name: %@ - Price: %f",[product localizedTitle],[[product price] doubleValue]);      
        NSLog(@"Product identifier: %@", [product productIdentifier]);
    }       

    for(NSString *invalidProduct in response.invalidProductIdentifiers)
        NSLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);

    [request autorelease];
    [myProduct release];
}
Run Code Online (Sandbox Code Playgroud)

kgu*_*dge 15

检查你的skProductsRequest回调,这可能会显示它是由无效的产品ID引起的,不幸的是,在沙盒上调试很麻烦

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
    NSArray *items = response.products;

    for(SKProduct *item in items)
    {
        NSLog(@"Product title: %@" , item.localizedTitle);
        NSLog(@"Product description: %@" , item.localizedDescription);
        NSLog(@"Product price: %@" , item.price);
        NSLog(@"Product id: %@" , item.productIdentifier);
    }

    for (NSString *invalidProductId in response.invalidProductIdentifiers)
    {
        NSLog(@"Invalid Product title: %@" , item.localizedTitle);
        NSLog(@"Invalid Product description: %@" , item.localizedDescription);
        NSLog(@"Invalid Product price: %@" , item.price);
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }
}
Run Code Online (Sandbox Code Playgroud)

假设它是由无效的产品ID引起的,通过以下检查列表运行

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

你有没有检查过你的产品清仓?

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

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

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

您是为iPhone OS 3.0或更高版本构建的吗?

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

自从将产品添加到iTunes Connect后,您有几个小时的时间吗?

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


ben*_*ong 7

尝试从您正在测试的手机上删除您的应用,然后"构建和调试".

如果这不能解决您的问题,我建议您阅读以下博客文章.

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