

Nextrek
@ 67
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
// // InAppPurchaseObserver.m // Foresta // // Created by Fabrizio on 18/12/12. // Copyright (c) 2012 Odyssey. All rights reserved. // #import "InAppPurchaseObserver.h" @implementation InAppPurchaseObserver // The transaction status of the SKPaymentQueue is sent here. - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { for(SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { case SKPaymentTransactionStatePurchasing: // Item is still in the process of being purchased [[NSNotificationCenter defaultCenter] postNotificationName:@"purchasing" object:nil]; break; case SKPaymentTransactionStatePurchased: // Item was successfully purchased! // --- UNLOCK FEATURE OR DOWNLOAD CONTENT HERE --- // The purchased item ID is accessible via // transaction.payment.productIdentifier [[NSNotificationCenter defaultCenter] postNotificationName:@"paymentComplete" object:nil]; // After customer has successfully received purchased content, // remove the finished transaction from the payment queue. [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; break; case SKPaymentTransactionStateRestored: // Verified that user has already paid for this item. // Ideal for restoring item across all devices of this customer. // --- UNLOCK FEATURE OR DOWNLOAD CONTENT HERE --- // The purchased item ID is accessible via // transaction.payment.productIdentifier [[NSNotificationCenter defaultCenter] postNotificationName:@"paymentRestored" object:nil]; // After customer has restored purchased content on this device, // remove the finished transaction from the payment queue. [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; break; case SKPaymentTransactionStateFailed: // Purchase was either cancelled by user or an error occurred. // if (transaction.error.code != SKErrorPaymentCancelled) { // // A transaction error occurred, so notify user. // [[NSNotificationCenter defaultCenter] postNotificationName:@"paymentFailed" object:nil]; // } // [[NSNotificationCenter defaultCenter] postNotificationName:@"paymentFailed" object:nil]; // Finished transactions should be removed from the payment queue. [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; break; } } } @end |
Commits for Nextrek/iOS/Emmanuele Rossi/Trickster/Trickster/InAppPurchaseObserver.m
Revision | Author | Commited | Message |
---|---|---|---|
67 |
![]() |
Thu 23 Jan, 2014 14:31:55 +0000 | Emmanuele Rossi apps |