I was following http://www.raywenderlich.com/21081/introduction-to-in-app-purchases-in-ios-6-tutorial
He said to add the following line in Appdelegate.m at the beginning of application:didFinishLaunchingWithOptions:
[RageIAPHelper sharedInstance];
Where should I add this line in cocos2dx project?
And one more question should I need to implement these functions or they are just the part of GUI covered in this tutorial?
- (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(productPurchased:) name:IAPHelperProductPurchasedNotification object:nil];
}
- (void)viewWillDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)productPurchased:(NSNotification *)notification {
NSString * productIdentifier = notification.object;
[_products enumerateObjectsUsingBlock:^(SKProduct * product, NSUInteger idx, BOOL *stop) {
if ([product.productIdentifier isEqualToString:productIdentifier]) {
[self.tableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:idx inSection:0]] withRowAnimation:UITableViewRowAnimationFade];
*stop = YES;
}
}];
}