An-droid
An-droid

Reputation: 6485

No response from SKProductsResponse with In App Purchase

As in the title i'm not getting any response from SKProductsResponse.

How i am doin it :

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    //self.tableView.hidden = TRUE;

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productsLoaded:) name:kProductsLoadedNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:) name:kProductPurchasedNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchaseFailed:) name:kProductPurchaseFailedNotification object: nil];

    Reachability *reach = [Reachability reachabilityForInternetConnection]; 
    NetworkStatus netStatus = [reach currentReachabilityStatus];    
    if (netStatus == NotReachable) 
    {        
        progressHud = [InAppProgressHud showHUDAddedTo:self.navigationController.view animated:YES];
        progressHud.labelText = @"Pas de connection internet";
        progressHud.detailsLabelText = @"Activez votre 3G ou le WIFI et rééssayez";
        //[self performSelector:@selector(dismissHUD:) withObject:nil afterDelay:3.0];
    } 
    else 
    {        
        if ([InAppPurchaseSingleton sharedHelper].Products == nil) 
        {
            [[InAppPurchaseSingleton sharedHelper] requestProducts];
            progressHud = [InAppProgressHud showHUDAddedTo:self.navigationController.view animated:YES];
            progressHud.labelText = @"Chargement...";
            [self performSelector:@selector(timeout:) withObject:nil afterDelay:30.0];
        }
    }
}

My requests :

-(void)requestProducts 
{
    self.request = [[[SKProductsRequest alloc]initWithProductIdentifiers:productIdentifiers] autorelease];
    request.delegate = self;
    [request start];
}

And the response callback :

-(void)productsRequest:(SKProductsRequest *)requestLocal didReceiveResponse:(SKProductsResponse *)response 
{  
    self.products = response.products;

    for (SKProduct *prod in self.Products)
    {
        NSLog(@"Product title: %@" , prod.localizedTitle);
        NSLog(@"Product description: %@" , prod.localizedDescription);
        NSLog(@"Product price: %@" , prod.price);
        NSLog(@"Product id: %@" , prod.productIdentifier);
    }
    self.request = nil;    
   [[NSNotificationCenter defaultCenter] postNotificationName:kProductsLoadedNotification object:products];    
}

The problem is that the callback is never called, i get NO response, nothing happen. I'm not even getting error log, nothing =(

->I know that internet connexion is ok

->I tried on ios 5.1 simulator, AND on a device and i have the same result in both

->I'm logged out from Itunes connect

->My application BundleId : fr.eamdev.testapp

->Version : 0.2 in Prepare for Upload

->I have 3 IAP : fr.eamdev.testapp.package_1, fr.eamdev.testapp.package_2, fr.eamdev.testapp.package_3 // Non consummable // Cleared for sale : Yes // Ready to submit

Does anyone have an idea, i'm quiet desesperate here TT.TT So you know i already got through Troy Brant's In App Purchases: A Full Walkthrough and Ray Wenderlich's tuto

Upvotes: 0

Views: 1105

Answers (1)

Gordon Dove
Gordon Dove

Reputation: 2577

Here are a couple of things to check.

Try the 4.3 sim. When I call this on the 4.3 sim, I get an error message in the log that says :- 2012-07-18 18:45:03.501 shadowslide[10598:13703] : Failing immediately in simulator

It works normally in the 5.1 sim. This will tell you if you're getting the call out OK.

The code you've posted all looks good to me ( autorelease? not using ARC?), so I'm wondering if you maybe have a problem with the singleton ( hope you don't feel insulted :) ). If the singleton creation fails, then the other calls will fail silently. Since you're not storing the return from the singleton shared helper, you've won't have been able to check it in the debugger.

Hope this helps

Upvotes: 1

Related Questions