ios - 在应用程序购买中无法从 iTunes Connect 获取产品标识符?

标签 ios objective-c in-app-purchase plist app-store-connect

我在我的项目中使用应用程序内购买。目前,购买工作正在沙箱中进行。但我发现了一个有关产品标识符的问题。现在我正在对产品标识符进行硬编码,如下所示。我手动将产品标识符存储在 plist (ProductId.plist) 中(请引用图片)

#import "RageIAPHelper.h"

@implementation RageIAPHelper

+ (RageIAPHelper *)sharedInstance {
    static dispatch_once_t once;
    static RageIAPHelper * sharedInstance;
    dispatch_once(&once, ^{
        NSString* plistPath = [[NSBundle mainBundle] pathForResource:@"ProductId" ofType:@"plist"];

        NSArray * contentArray = [NSArray arrayWithContentsOfFile:plistPath];
        NSLog(@"content aray:%@",contentArray);
        NSSet * productIdentifiers= [NSSet setWithArray:contentArray];
        sharedInstance = [[self alloc] initWithProductIdentifiers:productIdentifiers];
    });
    return sharedInstance;
}

@end  

//应用程序购买教程中来自 RAY WENDERLICH 的代码

ProductId.PLIST

现在的问题是我无法从 iTunes Store 动态获取产品标识符。那么我如何从 itunes 商店获取产品 id 而不是在 plist 中进行硬编码??? 请帮忙

最佳答案

您可以执行以下操作来获取产品数据。

 NSSet *productIdentifiers = [NSSet setWithObject:@"com.****.******"];
self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
self.productsRequest.delegate = self;
[self.productsRequest start];

该代表将接到电话,获取您所需的产品信息

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response

关于ios - 在应用程序购买中无法从 iTunes Connect 获取产品标识符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17872384/

相关文章:

iphone - 在没有导航 Controller 堆栈的情况下,以动画方式将 View Controller 从一个 View Controller 过渡到另一个 View Controller

android - 在 React-Native Expo 的应用程序购买中?

iphone - 应用程序因 17.2 条款而被拒绝。询问电子邮件 ID

iOS api暴露PointOfInterest时间

ios - NSArray 键 => 值,

iphone - 使用 Core Graphics 绘制图形线

ios - 自动续订购买的应用程序拒绝 - 准则 3.1.2 - 业务 - 付款 - 订阅

ios - UIViewPropertyAnimator 停止重复

ios - 从 GMSMapView 隐藏地铁站

ios - 有没有办法以编程方式提供应用内购买?