这是一个switch语句,我发现了错误:
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;
}
最后两种情况,加上默认情况,给了我以下错误:
无法从switch语句跳转到此case标签
我已经多次使用switch语句;这是我第一次看到这个.代码是从一个教程(here)中复制的,我正在try 将其改编为我的应用程序.谢谢你在这件事上的帮助.SD