I'm trying t follow this tutorial to implement inApp Purchase in my game with cocos2d.
But when I try to show the products in my scene, get this error:
Parse issue, expected expression
in this line:
[[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^BOOL sucess, NSArray *products2] {
this is my code inside the scene:
NSArray *products = nil;
[[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^BOOL sucess, NSArray *products2] {
if (sucess) {
products = products2;
for (int i == 1; i<=products; products.count) {
SKProduct *product = (SKProduct *) products[i];
CCLabelTTF *productlabel = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"%@", product.localizedTitle] fontName:@"Verdana-Bold" fontSize:18.0f];
productlabel.position = ccp(200/i,200);
}
}
}];
This is my RageIAPHelper.m:
@implementation RageIAPHelper
+ (RageIAPHelper *)sharedInstance {
static dispatch_once_t once;
static RageIAPHelper * sharedInstance;
dispatch_once(&once, ^{
NSSet * productIdentifiers = [NSSet setWithObjects:
@"com.razeware.inapprage.drummerrage",
@"com.razeware.inapprage.itunesconnectrage",
@"com.razeware.inapprage.nightlyrage",
@"com.razeware.inapprage.studylikeaboss",
@"com.razeware.inapprage.updogsadness",
nil];
sharedInstance = [[self alloc] initWithProductIdentifiers:productIdentifiers];
});
return sharedInstance;
}
@end
NSArray *products = nil;
[[RageIAPHelper sharedInstance] requestProductsWithCompletionHandler:^(BOOL sucess, NSArray *products2) {
if (sucess) {
products = products2;
for (int i == 0; i < products.count; i++) {
SKProduct *product = (SKProduct *) products[i];
CCLabelTTF *productlabel = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"%@", product.localizedTitle] fontName:@"Verdana-Bold" fontSize:18.0f];
productlabel.position = ccp(200/i,200);
}
}
}];