是否可以快速替换弃用SKPaymentTransaction.transactionReceipt?
完整代码:
// saves a record of the transaction by storing the receipt to disk
- (void)recordTransaction:(SKPaymentTransaction *)transaction {
if ([transaction.payment.productIdentifier isEqualToString:[self getProductId:gFullVersion]]) {
// save the transaction receipt to disk
[[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:[self getProductId:gFullVersion]];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
答案 0 :(得分:5)
正确的答案应该是:
[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]
完整代码:
// saves a record of the transaction by storing the receipt to disk
- (void)recordTransaction:(SKPaymentTransaction *)transaction {
if ([transaction.payment.productIdentifier isEqualToString:[self getProductId:gFullVersion]]) {
// save the transaction receipt to disk
[[NSUserDefaults standardUserDefaults] setValue:[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]] forKey:[self getProductId:gFullVersion]];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}