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 to verify run time, that dict[@"block"]and dict[@"queue"]- this is the type that I expected? I have typedef void(^handler)();, and I have to be sure that dict[@"block"]is a type handler. As I know, blocks and queues are actually objective-c objects, but do not comply with the protocol <NSObject>. So, do it anyway?
Thanks in advance!
source
share