Responding to a Successful Purchase
In order to respond to a successful purchase, we had to add an instance of SKPaymentTransactionObserver
to the default SKPaymentQueue
back in Listing 10–2. We are now ready to look at the code that gets called when the SKPaymentQueue
successfully processes a purchase, as shown in Listing 10–8.
Listing 10–8. ExtrasController.m
(paymentQueue: updatedTransactions:
)
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
for (SKPaymentTransaction* transaction in transactions){
if (transaction.transactionState == SKPaymentTransactionStatePurchased || transaction.transactionState == SKPaymentTransactionStateRestored){ NSString* productIdentifier = transaction.payment.productIdentifier; ...
Get Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.