【发布时间】:2018-10-22 02:31:22
【问题描述】:
我正在开发一个包含应用内购买的 Cordova 应用。 我已经在 Android 端工作了,所以plugin 流程正在工作。
现在我正在测试 iOS 端,我无法正确获取产品:它们无效且不完整,应用似乎无法下载产品数据。
- 我在 iTunes 中定义了 IAP(消耗品)项目、关联的虚拟图像,它们显示“准备提交”状态(黄色项目符号)
- IAP 产品也在新应用版本页面中关联,尚未提交审核。
- 我在 iTunes 页面上看到这条消息:“您的第一个应用内购买必须与新的应用版本一起提交。从应用的应用内购买部分中选择它,然后单击提交。”
- 我正在使用直接从 XCode 和 TestFlight 编译和安装的应用程序在真实设备上进行测试
我检查了这个问题,但没有找到明确的解决方案,我的问题是:为什么我无法从 iTunes 正确下载我配置的产品?
- 我是否必须在开始测试之前提交整个应用以获得 IAP 批准,或者
- 应该可以在本地测试(并获取产品)IAP 内容而无需 Apple 提交/批准任何应用程序(这可能是软件问题)?
我不知道该怎么做。提前感谢您的帮助。
更新
这是我使用的基本代码,通过 plugin 在 iTunes 上配置 IAP 产品:
function storeInitialize() {
store.register({
id: "creds_500",
type: store.CONSUMABLE
});
store.ready(function() {
console.log("\\o/ STORE READY \\o/");
console.log(JSON.stringify(store.get("creds_500")));
});
// When any product gets updated, refresh the HTML.
store.when("product").updated(function(p) {
console.info("Updating " + p.id);
console.log(JSON.stringify(p));
});
// Signal order errors
store.when("product").error(function() {
utils.userInfo("Il tuo ordine non è stato processato.");
});
// Load product data from the servers and restore whatever already have been purchased by the user.
store.refresh();
}
这是使用 iPhone 4s 设备从 XCode 安装应用程序的 Safari 控制台的输出:
[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Info] Updating creds_500
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
[Log] \o/ STORE READY \o/
[Log] {"id":"creds_500","alias":"creds_500","type":"consumable","state":"invalid","title":null,"description":null,"priceMicros":null,"price":null,"currency":null,"loaded":true,"canPurchase":false,"owned":false,"downloading":false,"downloaded":false,"additionalData":null,"transaction":null,"valid":false}
因此,几乎所有 IAP 字段都为空,包括价格、标题和描述(在 iTunes 端定义),并且产品“无效”“不可购买”。 我在其他帖子中发现,在 Apple 方面,测试目的不需要批准。
我哪里做错了?
【问题讨论】:
标签: ios cordova in-app-purchase cordova-plugins