Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (transaction.transactionState) {
- case SKPaymentTransactionStatePurchasing:
- // show wait view here
- statusLabel.text = @"Processing...";
- break;
- case SKPaymentTransactionStatePurchased:
- [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
- // remove wait view and unlock iClooud Syncing
- statusLabel.text = @"Done!";
- NSError *error = nil;
- [SFHFKeychainUtils storeUsername:@"IAPNoob01" andPassword:@"whatever" forServiceName: kStoredData updateExisting:YES error:&error];
- // apply purchase action - hide lock overlay and
- [oStockLock setBackgroundImage:nil forState:UIControlStateNormal];
- // do other thing to enable the features
- break;
- case SKPaymentTransactionStateRestored:
- [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
- // remove wait view here
- statusLabel.text = @"";
- break;
- case SKPaymentTransactionStateFailed:
- if (transaction.error.code != SKErrorPaymentCancelled) {
- NSLog(@"Error payment cancelled");
- }
- [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
- // remove wait view here
- statusLabel.text = @"Purchase Error!";
- break;
- default:
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement