如何解决cordova-plugin-purchase:即使在调用 order 后,iOS 也不做任何事情
我们正在使用 Ionic 和 cordova-plugin-purchase(也称为 In App Purchase 2)来实现购买订阅。 Android 运行得非常好 - iOS 给我们带来了很多问题。
使用产品名称调用 order
函数应显示 iOS 购买弹出窗口,购买应照常继续。
然而,在调用 order
函数后,订阅产品的状态变为 requested
但之后没有任何反应。没有弹出窗口出现。奇怪的是,就在昨天,我们还能够购买该产品,而在订阅到期后,我们又能够再次购买。它工作得很好。但是,今天,在产品再次过期后,点击订单功能只是将产品的状态更新为requested
,但之后没有任何反应。购买在 Android 上也运行得很好——只是 iOS 非常奇怪并且总是产生错误和问题。有时,当我们更改沙箱帐户并使用新帐户时,它可以工作,但有时,它会突然停止工作。
我们尝试尽可能地简化代码,以至于只有这些是重要的部分:
// this just automatically sets the validator to the correct URL which changes depending on the user's ID.
this.subscriptions.add(
this.status.userData.subscribe(data => {
this.userData = data;
this.store.validator = `https://xxxxxxxxxxx/api/app/users/${ data.id }/purchased`;
})
);
this.store.register([
{
id: this.MONTHLY_SUBSCRIPTION,type: this.store.PAID_SUBSCRIPTION
},{
id: this.YEARLY_SUBSCRIPTION,type: this.store.PAID_SUBSCRIPTION
}
]);
this.store.error((error) => {
console.log('ERROR',error);
});
this.store.when(this.YEARLY_SUBSCRIPTION).updated((p) => {
this.yearly = p;
console.log('yearly',p.state);
});
this.store.when(this.MONTHLY_SUBSCRIPTION).updated((p) => {
this.monthly = p;
console.log('month',p.state);
});
this.store.when(this.YEARLY_SUBSCRIPTION)
.approved(p => p.verify())
.verified(p => p.finish())
.owned(p => this.continue(true,p.id));
this.store.when(this.MONTHLY_SUBSCRIPTION)
.approved(p => p.verify())
.verified(p => p.finish())
.owned(p => this.continue(true,p.id));
this.store.refresh();
调用 this.store.order(this.MONTHLY_SUBSCRIPTION);
没有任何作用。有趣的部分是调用 this.store.order(this.YEARLY_SUBSCRIPTION);
确实显示 iOS 购买弹出窗口。没有错误输出或任何东西。我们也曾尝试在 this.store.autoFinishTransactions = true;
之前使用 this.store.refresh();
,但这似乎没有任何作用。
我们最近运气不佳,如果有人可以提供有关如何解决此问题的建议或提示(可能是插件中的错误?我确实尝试提交问题,但是...)
非常感谢您,如果需要,我很乐意提供任何进一步的信息。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。