如何解决如何检查ionic 3已拥有/购买的非消耗性产品?
我有一个视频列表页面。单击视频时,我必须检查视频是购买还是拥有的。所以写这样的代码。
gotoVideo(video:any){
alert(JSON.stringify(video))
if(video.product_id == null || video.product_id == ''){
this.navCtrl.push(SingleVideoPage,{video:video,user_type:"student"});
}else{
if(video.owned == true){
//go
this.navCtrl.push(SingleVideoPage,user_type:"student"});
}else{
let iapProduct:IAPProduct = this.store.products.find(p => p.id == video.product_id);
this.store.order(iapProduct).then(p => {
// Purchase in progress!
// alert(JSON.stringify(p))
},e => {
// alert(JSON.stringify(e))
this.presentAlert(`Failed to purchase: ${e}`);
}).catch((e)=>{
// alert(JSON.stringify(e))
});
this.store.when('product')
.owned((p: IAPProduct) => {
alert('owned')
p.finish();
this.ref.detectChanges();
return p.verify();
});
this.store.when('product')
.approved((p: IAPProduct) => {
alert('approved')
p.finish();
this.ref.detectChanges();
return p.verify();
});
}
}
}
但是它不起作用。始终拥有:沙箱中的false 如何实现这一目标。请帮助我。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。