Get confused a bit with a question of how to pass the block to the method but without the defined (concrete) params.
It's not clear to me exactly what you are asking here, but it sounds like you wish to be able to pass any block to a method which presumably at some later point you cast to a specific block type so you can call it. If so:
A block in modern (post late 2014 - see this question and answer for why that date) ARC Objective-C is a fully automatically managed object. Therefore the standard "any object" type id
may be used to pass any block.
For example given:
// a specific block type
typedef id (^SelectBlock)(NSArray *, NSUInteger);
// method which takes a general object and casts to a specific block type
- (void) useBlock:(id)blockObj
{
SelectBlock sb = (SelectBlock)blockObj;
id item = sb(@[@"apple", @"pear", @"plum"], 2);
NSLog(@"Result: %@", item);
}
// method which pass a block as "any object"
- (void) test:(NSUInteger)offset
{
SelectBlock mySelect = ^(NSArray *collection, NSUInteger index)
{
return collection[index-offset];
};
[self useBlock:(id)mySelect];
}
then the call:
[self test:1];
will result in pear
being output.
Passing a block "generically" in this way is only useful if the original type is somehow known so the id
typed valued can be cast back to the correct block type to invoke the block.