2012-07-18 79 views
0

正如在标题中我没有从SKProductsResponse得到任何回应。SKProductsResponse在In App Purchase中没有回应

如何我正在干什么吧:

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

我的请求:

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

和响应回调:

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

的问题是,回调从来没有所谓的,我得到没有回应,没有发生。我还没有得到错误日志,没有什么=(

- >我知道,互联网联接是确定

- >我在iOS 5.1试过模拟器和设备上和我有两个相同的结果

- >我从iTunes登出连接

- >我的应用程序BundleId:fr.eamdev.testapp

- >版本:0.2在准备上传

- >我有3个IAP:fr.eamdev.testapp.package_1,fr.eamdev.testapp.package_2,fr.eamdev.testapp.package_3 //非消耗//清除待售:是//准备提交

没有任何人有一个想法,我在这里安静desesperate TT.TT 所以,你知道我已经通过特洛伊布兰特的了的In App Purchase:一个完整​​的演练和雷Wenderlich的政党成员

回答

1

这里有几件事情来检查。

试试4.3 sim。 当我把这个在4.3 SIM卡,我得到的日志中,指出的错误信息: - 2012-07-18 18:45:03.501 shadowslide [10598:13703]:在模拟器立即失败

它的工作原理通常在5.1 sim。这会告诉你,如果你把这个电话叫出来的话。

你发布的代码对我来说看起来不错(autorelease?不使用ARC?),所以我想知道你是否可能对单例有问题(希望你不觉得受到侮辱:))。如果创建单例失败,那么其他调用将默默失败。既然你没有存储单体共享助手的返回值,你将无法在调试器中检查它。

希望这可以帮助

+0

我已经试过4.3(因为我不知道该怎么做x)。在日志中我看到“4.3模拟器不适用于In App Purchase”左右。结果,当我试图让我的产品清单是相同的。我的超时方法在等待响应20秒后被调用。 Tomorow我会调试我的单身人士是你的意见(我不觉得受到侮辱)我没有,但它可能是一个分配问题。我没有使用ARC,因为我使用的是cocos2d,我使用旧的方式感觉更舒适XD – 2012-07-18 16:57:10

+0

我测试了我的单身很多次,没有发现任何可疑的东西。我的变量“sharedHelperInstance”只被分配一次,并且正确...但是最后一次,我在模拟器IT WORKED上执行了我的应用程序,我不明白为什么,我没有改变我的代码中的任何内容。我只是尝试调试一步到一步模式和一些调试日志...无论如何,现在它的工作正常感谢您的答案。 – 2012-07-19 12:02:10