NOTE: I’m developing for Mac, not iOS!
- (void)recordTransaction:(SKPaymentTransaction *)transaction
{
if ([transaction.payment.productIdentifier isEqualToString:kInAppProIdentifier])
{
[[NSUserDefaults standardUserDefaults] setValue:transaction.transactionReceipt forKey:@"proUpgradeTransactionReceipt" ];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
I get this error from the compiler:
error: property 'transactionReceipt' not found on object of type 'SKPaymentTransaction *'; did you mean 'transactionDate'? [3]
Also, I can’t find the transactionReceipt property in the reference for the SKPaymentTransaction class! (Even though this page contains some references to “receipts”, there’s not a transactionReceipt property).
But the documentation says it is supposed to exist!
A successful transaction includes a transactionIdentifier property and a transactionReceipt property that record the details of the processed payment. Your application is not required to do anything with this information. You may wish to record this information to establish an audit trail for the transaction. If your application uses a server to deliver content, the receipt can be sent to your server and validated by the App Store.
What is wrong with this?
I class-dumped StoreKit to find out if this method was present and it is. Here is the header:
You can use this method with [transaction transactionReceipt] (and get a warning). Apple may or may not consider this use of a private method and reject your application; but, for testing purposes, it is there.