我正在使用图书馆RMStore - 这就是我目前所拥有的。
1)购买汽车可再生订阅&验证退回的收据。
[[RMStore defaultStore]addPayment:[Environment environment].premiumProductIAPId success:^(SKPaymentTransaction *transaction) {
[[RMStore defaultStore].receiptVerificator verifyTransaction:transaction success:^{
//enable premium service
} failure:^(NSError *error) {
}];
} failure:^(SKPaymentTransaction *transaction, NSError *error) {
}];
2)在每次应用启动检查时,订阅对该日期有效,并启用高级服务(如果
)RMAppReceipt *appReceipt = [RMAppReceipt bundleReceipt];
if (appReceipt){
NSInteger isActive = [appReceipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:[Environment environment].premiumProductIAPId forDate:[NSDate date]];
//enable premium service if active
}
3)如果用户在其他设备上启动应用,则允许他们通过刷新收据(如果已存在)来恢复购买,并检查购买中是否存在有效订阅。
"In most cases, all your app needs to do is refresh its receipt and deliver the products in its receipt."
- 这是指南。这是代码:
[[RMStore defaultStore]refreshReceiptOnSuccess:^{
if ([receipt containsActiveAutoRenewableSubscriptionOfProductIdentifier:[Environment environment].premiumProductIAPId forDate:[NSDate date]]){
//enable
}else{
//no longer active
}
} failure:^(NSError *error) {
}];
我的问题: