SKProductsResponse 在模拟器上返回无效的 ProductIdentifiers,尽管应用程序中的 productId 与 iTunes Connect 之间是一致的

SKProductsResponse returning invalidProductIdentifiers on simulator inspite uniformity between the productId in application and iTunes Connect

作为尝试在 iOS 应用程序中进行应用内购买的初学者,我遵循了以下步骤:

  1. 在应用程序购买功能中启用。
  2. 在开发者帐户上创建了临时配置文件并下载了 它。
  3. 已创建 iTunes Connect 应用程序提交。
  4. 在 iTunes 的功能部分创建应用内购买产品 连接。
  5. 创建了相同的产品标识符数组。还在视图控制器 class.

    中实现了必需的委托
    #import <UIKit/UIKit.h>
    #import <StoreKit/StoreKit.h>
    @interface ViewController :UIViewController<SKProductsRequestDelegate,SKPaymentTransactionObserver,SKRequestDelegate>
    

在viewdidload()中

 productIds = [NSArray arrayWithObjects:@"pro1",@"pro2", nil];

另外,

  -(void)viewWillAppear:(BOOL)animated
   {
   if([SKPaymentQueue canMakePayments]){
   SKProductsRequest *requestPro = [[SKProductsRequest alloc]initWithProductIdentifiers:[NSSet setWithArray:productIds]];
  requestPro.delegate = self;
  [requestPro start];
   }
   else{
    NSLog(@"Cannot perform In App Purchases.");
    }
    }
  1. 但是 -(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response 实现返回无效产品。

请帮助我了解缺少的内容。

您需要在真实设备上测试大多数与应用内购买相关的功能。它们在模拟器上不起作用!