Assumes you can somehow include self in a block variable
Like this:
- (void)doFoo { // Assume the block receives an int, returns an int, // and cast self to the corresponding block type int (^selfBlock)(int) = (int (^)(int))self; // Call itself and print the return value printf("in doFoo: %d\n", selfBlock(42)); }
Please note that (in most cases) you need to correct the block signature so that the compiler can configure the call site in accordance with the target ABI platform. In the above example, the signature is an int return type, the only parameter of type int .
Full example:
user557219
source share