Sachin Kumaram
Sachin Kumaram

Reputation: 920

How do I configure in-app purchase for iTunes?

How do I configure iTunes Connect for in-app purchase? I have added products in iTunes Connect, but in response.product, it always returns an empty value.

- (void)requestProducts {
    NSSet *productIdentifiers = [NSSet setWithObject:@"com.classic.caddycommonground.t1" ];
    //NSLog(@"product identifier %@",_productIdentifiers);
    self.request = [[[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers] autorelease];
    _request.delegate = self;
    [_request start];
}

- (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: %@" , items.localizedTitle);
        NSLog(@"Invalid Product description: %@" , items.localizedDescription);
        NSLog(@"Invalid Product price: %@" , items.price);
        NSLog(@"Invalid product id: %@" , invalidProductId);
    }
    */

    //NSLog(@"Received products results..."); 
    NSLog(@"response product %@",response.products);
    self.products = response.products;
    self.request = nil;    

    [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:_products];    
}

Upvotes: 1

Views: 495

Answers (1)

Shubhank
Shubhank

Reputation: 21805

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

Follow the above tutorial..First check if your code is valid by comparing..If it is Then ..There is a special section when you get Invalid Products Id in return as response..Go through it..

Upvotes: 1

Related Questions