iOS 应用内购买 - 未知产品标识符

iOS In app purchase - Unknown product identifier

我正在尝试在我的 Cordova 应用程序中使用 iOS 的应用内购买。

到目前为止,我尝试使用了 2 个插件: - https://github.com/AlexDisler/cordova-plugin-inapppurchase - https://github.com/j3k0/cordova-plugin-purchase

None 他们的工作。由于最后一个插件使用了某种自定义收据验证平台,我决定跳过那个。

我的第一个插件代码如下所示:

window.inAppPurchase
.getProducts([subscriptions.FLOXER_PRO_IOS_PRODUCT_ID])
.then(function(products) {
    console.log(products);
    window.inAppPurchase
        .buy(subscriptions.FLOXER_PRO_IOS_PRODUCT_ID)
        .then(function(data) {
            console.log(data);
        })
        .catch(function(err) {
            console.log(err);
        });
})
.catch(function(err) {
    console.log(err);
});

Safari 控制台日志输出:

[Log] [] (0) (bundle.js, line 67)
[Log] {errorMessage: "Unknown product identifier", errorCode: 100} (bundle.js, line 67)

XCode 日志:

2016-11-07 11:46:32.940653 Floxer[831:207602] Using UIWebView
2016-11-07 11:46:32.942682 Floxer[831:207602] [CDVTimer][handleopenurl] 0.057995ms
2016-11-07 11:46:32.943943 Floxer[831:207602] [CDVTimer][intentandnavigationfilter] 1.214981ms
2016-11-07 11:46:32.944015 Floxer[831:207602] [CDVTimer][gesturehandler] 0.042021ms
2016-11-07 11:46:32.944038 Floxer[831:207602] [CDVTimer][TotalPluginStartup] 1.437962ms
2016-11-07 11:46:33.316991 Floxer[831:207602] Resetting plugins due to page load.
2016-11-07 11:46:34.149838 Floxer[831:207602] Finished load of: file:///var/containers/Bundle/Application/0CFA94CE-294B-43C8-8BCD-28C76B8F303E/Floxer.app/www/index.html
2016-11-07 11:46:42.654647 Floxer[831:207602] RMStore: products request received response
2016-11-07 11:46:42.654829 Floxer[831:207602] RMStore: invalid product with id com.coqtail.floxer.pro_account
2016-11-07 11:46:42.676313 Floxer[831:207602] RMStore: unknown product id com.coqtail.floxer.pro_account
2016-11-07 11:47:34.804099 Floxer[831:207602] RMStore: products request received response
2016-11-07 11:47:34.804265 Floxer[831:207602] RMStore: invalid product with id com.coqtail.floxer.pro_account
2016-11-07 11:47:34.870319 Floxer[831:207602] RMStore: unknown product id com.coqtail.floxer.pro_account

我正在为 iOS 使用模拟器(未登录),这可能是一个潜在的问题吗?您需要真实帐户来测试应用内购买吗?

我在 iTunes Connect 中创建了应用内购买,但尚未获得批准。这应该不是问题吧?我假设您在测试期间不需要经过验证的应用内购买。

以前有人遇到过这个问题吗?我搜索 Google 好几天了,似乎找不到解决这个问题的明确方法...

帮助将不胜感激!

我遇到了类似的问题。我在 gitHub 上找到的答案对我有用:

您需要在 iTunes Connect 中签订 'Paid Applications' 合同才能显示您的付费产品。为此,请转到您的 iTunes Connect 主页和 select 'Agreements, Tax, and Banking'。填写您的联系方式、银行和税务信息。提交表格并等待 15 分钟以处理合同。

一个好的测试方法是添加免费的消耗品,这不需要 'Paid Applications' 合同。

感谢@stoconnor