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



我想在我的Cordova应用程序中使用iOS应用程序购买。

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

它们都不工作。由于上一个插件使用了某种自定义收据验证平台,我决定跳过它。

我的第一个插件的代码看起来像这样:

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模拟器(未登录),这可能是一个潜在的问题吗?你是否需要一个真实账户来测试iap ?

我在iTunes Connect中创建了我的In App Purchase,但它还没有被批准。这不应该是个问题,对吧?我猜你在测试过程中不需要验证iap。

以前有人遇到过这个问题吗?我在谷歌上搜索了几天,似乎找不到一个明确的解决这个问题的方法。

请帮忙!

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

你需要在iTunes Connect中有一个"付费应用程序"合同,你的付费产品才会出现。要做到这一点,请进入iTunes Connect主页,选择"协议,税务和银行"。填写您的联系方式,银行和税务信息。提交表格,等待15分钟合同处理。

一个好的测试方法是添加一个免费的可消费产品,这并不需要一个"付费应用"合同。

感谢@stoconnor

最新更新