0

Is it possible to invoke a block within another block?

For example:

-(void)doSomethingWithBlock:(void (^)(id))parameterBlock{

     Blah * object = [Blah doThisblock:^(id sender) {

     //invoke "parameterBlock" here..

     // do other things after as well..

     }
 }

If possible, how would I go about doing it?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
BigRed
  • 79
  • 10
  • Do you mean "How do I call a block?" – tadman May 15 '14 at 02:50
  • yeah my bad.. found out how to do it, via: parameterBlock(); thanks for the reply though :) – BigRed May 15 '14 at 02:51
  • 1
    possible duplicate of [Invoke block iOS](http://stackoverflow.com/questions/9484123/invoke-block-ios) – tadman May 15 '14 at 02:53
  • @BigRed Just note that if `paramaterBlock` is `nil` and you try to call it, an exception will be raised – MaxGabriel May 15 '14 at 02:53
  • Given the answer, what does this question have to do with calling a block from within a block? It seems the actual question was "how do I call a block?". – rmaddy May 15 '14 at 04:08

1 Answers1

0

I found that I could call the block by doing this:

    -(void)doSomethingWithBlock:(void (^)(id))parameterBlock{

            Blah * object = [Blah doThisblock:^(id sender) {

                   parameterBlock();

                   // do other things after as well..

           }
     }
BigRed
  • 79
  • 10