If I have the following objects:
@interface Simple : NSObject @end @interface Complex : Simple @end
And another object like:
@interface Test : NSObject +(void) doSomething:(void (^)(Simple*)) obj; @end
Everything works if I call the method as follows:
[Test doSomething:^(Simple * obj) { }]
When I try to call it instead:
[Test doSomething:^(Complex * obj) { }]
The compiler says that:
Incompatible block pointer types sending 'void (^)(Complex *__strong)' to parameter of type 'void (^)(Simple *__strong)'
Since Complex extends Simple , I thought it would work, as in Java.
Is there any way to achieve this somehow?
Mark
source share