Skip to content

Instantly share code, notes, and snippets.

@matthiasnagel
Created June 28, 2012 10:56
Show Gist options
  • Save matthiasnagel/3010662 to your computer and use it in GitHub Desktop.
Save matthiasnagel/3010662 to your computer and use it in GitHub Desktop.
no
bool showAlert = YES;
Category *category = [[curArticle articleCategories] anyObject];
if (category.in_app_purchase.length > 0) {
if ([category.in_app_purchase isEqualToString:@"frei"]) {
category.in_app_purchase = nil;
[self doArticle:curArticle];
showAlert = NO;
}
else {
for (SKProduct *product in [WoerterbuchInAppPurchase instance].purchasedProducts) {
if ([product.productIdentifier isEqualToString:[NSString stringWithFormat:@"com.mattnail.buchlexikon.%@",category.in_app_purchase]]) {
category.purchased = [NSNumber numberWithBool:YES];
[self doArticle:curArticle];
showAlert = NO;
break;
}
}
}
}
else {
[self doArticle:curArticle];
showAlert = NO;
}
if (showAlert) {
UIAlertView *alert = [[[UIAlertView alloc] initWithTitle:@"Hinweis" message:[NSString stringWithFormat:@"Bitte kaufen Sie das Paket %@ um diesen Artikel anzusehen",category.title] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil] autorelease];
[alert show];
}
[[DataManager instance] saveContext];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment