如何在IOS中获取应用内购买产品

问题描述 投票:0回答:1

我正在尝试为应用程序实现应用内购买。我已经实现了StoreKit2,并且在Xcode环境中,我可以顺利地进行购买,没有任何问题。一旦我进行了构建并将其进行试飞,在试飞构建中没有获取任何产品,没有错误,我还添加了记录器并进行了检查。

应用内购买产品现在处于

Waiting for review
状态。

下面的代码片段用于获取产品。

func fetchBundles(for productIds: [String]) async throws -> [Product] {
    guard productIds.count > 0 else { return [] }
    do {
        let products = try await Product.products(for: productIds)
        print(#file, #function, "products: \(products.count)", to: &logger)
        return products
    } catch {
        print(#file, #function, "error: \(error.localizedDescription)", to: &logger)
        throw error
    }
}

记录器:

    /Users/amal/Desktop/MyProjects/MamaLinc/MamaLinc/MamaLinc/Modules/Shop/ViewControllers/ShopViewController.swift getShopPageDetail() Constants.IN_APP_PURCHASE_ACTIVE: true, bundles: 4
/Users/amal/Desktop/MyProjects/MamaLinc/MamaLinc/MamaLinc/Modules/Shop/ViewControllers/ShopViewController.swift fetchInAPPProducts(with:) allIds: 11
/Users/amal/Desktop/MyProjects/MamaLinc/MamaLinc/MamaLinc/Helpers/InAPPPurchaseHelper.swift fetchBundles(for:) products: 0

我如何获取产品,提前谢谢。

ios swift in-app-purchase
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.