Questa è una dichiarazione interruttore che sto ottenendo gli errori sul:cosa sta causando questo: Non può saltare da un'istruzione switch per questo caso l'etichetta
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;
}
Gli ultimi due casi, più il valore predefinito, mi stanno dando la seguente errore:
Cannot jump from switch statement to this case label
Ho usato l'istruzione di interruttore molte, molte volte; questa è la prima volta che ho visto questo. Il codice è stato copiato da un tutorial (here), che sto cercando di adattare alla mia app. Gradirei l'aiuto su questo. SD
Potresti provare a inserire gli interni di tutti i blocchi 'case' nelle parentesi graffe e vedere se questo cambia qualcosa? In questo modo: http://www.apeth.com/iOSBook/ch01.html#EXswitch – matt
Non è possibile dichiarare "NSError * error = nil;" all'interno del caso senza racchiuderlo in un blocco (parentesi graffe) – Wain