Guest User

Untitled

a guest
Nov 19th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. bool showAlert = YES;
  2.  
  3. Category *category = [[curArticle articleCategories] anyObject];
  4.  
  5. if (category.in_app_purchase.length > 0) {
  6.  
  7. if ([category.in_app_purchase isEqualToString:@"frei"]) {
  8. category.in_app_purchase = nil;
  9. [self doArticle:curArticle];
  10. showAlert = NO;
  11. }
  12. else {
  13. for (SKProduct *product in [WoerterbuchInAppPurchase instance].purchasedProducts) {
  14. if ([product.productIdentifier isEqualToString:[NSString stringWithFormat:@"com.mattnail.buchlexikon.%@",category.in_app_purchase]]) {
  15. category.purchased = [NSNumber numberWithBool:YES];
  16. [self doArticle:curArticle];
  17. showAlert = NO;
  18. break;
  19. }
  20. }
  21. }
  22. }
  23. else {
  24. [self doArticle:curArticle];
  25. showAlert = NO;
  26. }
  27.  
  28. if (showAlert) {
  29. 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];
  30. [alert show];
  31. }
  32.  
  33. [[DataManager instance] saveContext];
Add Comment
Please, Sign In to add comment