objective c - What is causing this: Cannot jump from switch statement to this case label -


this question has answer here:

this switch statement getting errors on:

        switch (transaction.transactionstate) {          case skpaymenttransactionstatepurchasing:              // show wait view here             statuslabel.text = @"processing...";             break;          case skpaymenttransactionstatepurchased:              [[skpaymentqueue defaultqueue] finishtransaction:transaction];              // remove wait view , 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 ,             [ostocklock setbackgroundimage:nil forstate:uicontrolstatenormal];              // other thing enable 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;     } 

the last 2 cases, plus default, giving me following error:

cannot jump switch statement case label

i have used switch statement many, many times; first time have seen this. code has been copied tutorial (here), trying adapt app. appreciate on one. sd

c not swift. you'll happier if structure switch statements using curly braces round of cases interiors, this:

switch (tag) {     case 1: { // curly braces         // ...         break;     }     case 2: {  // curly braces         // ...         break;     }     case 3: {  // curly braces         // ...         break;     } } 

the level of curly braces allows things can't otherwise.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -