我正在尝试在我的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模拟器(未登录),这可能是一个潜在的问题吗?您是否需要真实账户来测试应用内购买?
我在iTunes Connect中创建了我的In App Purchase,但尚未批准。这应该不是问题吧?我假设您在测试期间不需要经过验证的In App Purchase。
以前有没有人遇到过这个问题?我正在搜索谷歌几天,似乎无法找到解决这个问题的明确解决方案......
帮助将不胜感激!
答案 0 :(得分:3)
我遇到了类似的问题。我在gitHub上找到的答案为我工作:
您需要在iTunes Connect中拥有“付费应用”合同才能显示您的付费产品。要执行此操作,请转到iTunes Connect主页,然后选择“协议,税务和银行业务”。填写您的联系人,银行和税务信息。提交表格并等待15分钟以便处理合同。
测试的一个好方法是添加免费的耗材产品,这不需要“付费应用”合同。
感谢@stoconnor