Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2011 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/8c0b5c3a8cd93204bb15 to your computer and use it in GitHub Desktop.
Save anonymous/8c0b5c3a8cd93204bb15 to your computer and use it in GitHub Desktop.
// AppDelegate.m
- (void)applicationDidFinishLaunching {
...
if ([SKPaymentQueue canMakePayments]) {
[[SKPaymentQueue defaultQueue] addObserver:self];
}
...
}
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
// processing code
[[NSNotificationCenter defaultCenter] postNotificationName:@"MyPurchaseNotification" object:self];
}
// MyPurchaseClass.m
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(gotTransactionNotification:) name:@"MyPurchaseNotification" object:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment