我的应用程序被Apple拒绝,因为没有为应用程序内购买恢复功能。
我正在使用Parse实现here,如果用户通过Alert控制器进行了先前的购买,并且用户选择了购买按钮时显示了恢复选项,则允许恢复购买。
所以我有两个问题:
Thansk In Advance
答案 0 :(得分:2)
隐藏在文档的深处是:
PFPurchase.restore();
如果已经购买,它会在观察者中执行该块 -
PFPurchase.addObserverForProduct("purchases.cases", block: { (transaction : SKPaymentTransaction!) -> Void in
//set boolean to user defaults when in app p[urcahse is made, access agian in Tablevoew to relase cases
let userDefaults = NSUserDefaults.standardUserDefaults();
userDefaults.setBool(true, forKey: "inAppPurchaseMade");
userDefaults.synchronize();
})
return true
}
答案 1 :(得分:1)
此link可能会有所帮助
另一件事是,苹果已恢复UIAlertController
您不需要自己添加,只需编写恢复处理代码和按钮。
//inside of an IBaction
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue]restoreCompletedTransactions];
// Then this is called
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
NSLog(@"%@",queue );
NSLog(@"Restored Transactions are once again in Queue for purchasing %@",[queue transactions]);
NSMutableArray *purchasedItemIDs = [[NSMutableArray alloc] init];
NSLog(@"received restored transactions: %i", queue.transactions.count);
for (SKPaymentTransaction *transaction in queue.transactions) {
NSString *productID = transaction.payment.productIdentifier;
[purchasedItemIDs addObject:productID];
NSLog (@"product id is %@" , productID);
// here put an if/then statement to write files based on previously purchased items
// example if ([productID isEqualToString: @"youruniqueproductidentifier]){write files} else { nslog sorry}
}
}