I have an array of dictionaries, that stores blocks and queues. After some method I need to execute it.
for (NSDictionary * dict in self.arrayOfBlocksAndQueues) {
if (!dict[@"block"] || !dict[@"queue"]) {
continue;
}
dispatch_block_t block = dict[@"block"];
dispatch_async(dict[@"queue"], ^{
block();
});
}
So my question is, how can I check in runtime, that dict[@"block"]
and dict[@"queue"]
are exactly the type I’m expected? I have a typedef void(^handler)();
and I need to be sure that dict[@"block”]
is type of handler
. As I know, blocks and queues are in fact objective-c objects, but don’t conforms to <NSObject>
protocol. So, is there anyway to do it?
Thanks in advance!