Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. switch (transaction.transactionState) {
  2.  
  3. case SKPaymentTransactionStatePurchasing:
  4.  
  5. // show wait view here
  6. statusLabel.text = @"Processing...";
  7. break;
  8.  
  9. case SKPaymentTransactionStatePurchased:
  10.  
  11. [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
  12.  
  13. // remove wait view and unlock iClooud Syncing
  14. statusLabel.text = @"Done!";
  15.  
  16. NSError *error = nil;
  17. [SFHFKeychainUtils storeUsername:@"IAPNoob01" andPassword:@"whatever" forServiceName: kStoredData updateExisting:YES error:&error];
  18.  
  19. // apply purchase action - hide lock overlay and
  20. [oStockLock setBackgroundImage:nil forState:UIControlStateNormal];
  21.  
  22. // do other thing to enable the features
  23.  
  24. break;
  25.  
  26. case SKPaymentTransactionStateRestored:
  27.  
  28. [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
  29.  
  30. // remove wait view here
  31. statusLabel.text = @"";
  32. break;
  33.  
  34. case SKPaymentTransactionStateFailed:
  35.  
  36. if (transaction.error.code != SKErrorPaymentCancelled) {
  37. NSLog(@"Error payment cancelled");
  38. }
  39. [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
  40. // remove wait view here
  41. statusLabel.text = @"Purchase Error!";
  42. break;
  43.  
  44. default:
  45. break;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement