iOS Blocks introspection

Viewed 3055

I would like to know two things:

1- Is it possible by using objective-c introspection to know the return type of a block.

For example: int (^CountBlock)(NSArray *array) I would like to know the type it will be returning is int.

The second question is:

2- Can I hold a reference to a generic block? What I mean with this, is basically can I do something like id myBlock and with this answer the first question.

What I tried

This kind of stuff is not possible:

id aBlock = ^{

    NSString * aString = @"OMG";

    return aString;
};

aBlock();

As the compiler sees that the id aBlock is not a function or a function pointer.

2 Answers
Related