I use invocation call block copy, I think it's equals to [block copy],but crashed why?
@implementation MyService
+ (void)load {
[MyService startRequest:^(id _Nonnull responseObject, NSError * _Nonnull error) {
NSLog(@"%@",self);
}];
}
+ (void)startRequest:(void (^)(id responseObject,NSError *error))object {
SEL sel = @selector(copy);
NSMethodSignature* methodSign = [object methodSignatureForSelector:sel];
NSInvocation* invocation = [NSInvocation invocationWithMethodSignature:methodSign];
[invocation setSelector:sel];
[invocation setTarget:object];
[invocation invoke];
}
@end