开发者

iPhone - Problem with in-app purchases

开发者 https://www.devze.com 2023-02-04 19:06 出处:网络
I\'ve created iPhone app with in-app purchase. Now, I\'m in testing phase. I created provisioning profile com.satyam.testapp

I've created iPhone app with in-app purchase. Now, I'm in testing phase.

I created provisioning profile com.satyam.testapp In iTunes connected I created the application and uploaded the images, screen shots, desscription etc. I also created two id's for in-app purchase. One is com.satyam.testapp.book1 and the other one is com.satyam.testapp.book5

I created test account also for verifying my in-app purchases.

Using com.stayam.testapp i created developer test profile and using the same in my developed applic开发者_如何转开发ation.

I logged out the itunes app store account in my iphone.

Now i started running my application on my iphone. Its saying that no items are there to purchase. But its not even asking me for credentials where i've to enter test account username and password.....

how to debug it?

Here's my delegate:

- (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];
}


Check your SKProductsRequest call back, which will probably show that it is caused by an invalid product id, which unfortunately can be a pain to debug on the sandbox

- (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);
    }
}

Assuming it is caused by an invalid product ID run through the following check list

  • Have you enabled In-App Purchases for your App ID?

  • Have you checked Cleared for Sale for your product?

  • 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?


Try deleting your app from the phone you are testing on, then "Build and Debug".

If that doesn't solve your problem, I would recommend going through the following blog post.

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


1- You can login with your test account from where you logged out the existing one. 2- For debuging, you have to wait for your products (com.satyam.testapp.book1 and com.satyam.testapp.book5) to become valid. Currently your products have to be in response.invalidProductIdentifiers list. You'll be asked for your test account credentials when your products will be valid. Sometimes it takes some time for products to become valid and be sure you signed contracts for paid Apps.


checkout whether your product id "com.satyam.testapp.book1" is same as the one you registered in your iTunes store, and you checked the "clear for sale" option

0

精彩评论

暂无评论...
验证码 换一张
取 消