Heena
Heena

Reputation: 754

problem retrieving list of products in InApp purchase in iphone app

I am using below code to retrieve list of products

-(void) viewWillAppear:(BOOL)animated
{
    if ([SKPaymentQueue canMakePayments]) {
        NSLog(@"Parental-controls are disabled");

        //Request products.Retrieving list of products
        SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"com.test.SinFinder"]];
        productsRequest.delegate = self;
        [productsRequest start];
    } else {
        NSLog(@"Parental-controls are enabled");
    }
}


- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
    SKProduct *validProduct = nil;
    int count = [response.products count];
    NSLog(@"count : %d",count);
    if (count > 0) {
        validProduct = [response.products objectAtIndex:0];
    } else if (!validProduct) {
        NSLog(@"No products available");
    }    
}

In handling response I am getting count zero and so in updatedTransactions methods it goes to SKPaymentTransactionStateFailed and logs error. I have no idea what is going wrong or what is missing Or Is this necessary i.e. list of products as I just need to lock a feature once app is purchased

Upvotes: 3

Views: 948

Answers (1)

Dinakar
Dinakar

Reputation: 1208

try to print the products on gdb and if you find the products as invalid ,refer this link in that case.

refer this for a complete look of developing in app into our application

TNQ

Upvotes: 1

Related Questions