I was wondering if this would also work for invoking class methods on a class object? For example if +stringForDate:usingFormatter: was a class method instead of an instance method:
SEL mySelector;
mySelector = @selector(stringForDate:usingFormatter:);
NSMethodSignature * sig = nil;
sig = [self methodSignatureForSelector:mySelector];
NSInvocation * myInvocation = nil;
myInvocation = [NSInvocation invocationWithMethodSignature:sig];
[myInvocation setTarget:[self class]]; // <-- will this work?
[myInvocation setSelector:mySelector];
by Dalmazio Brisinda — Oct 27
I was wondering if this would also work for invoking class methods on a class object? For example if +stringForDate:usingFormatter: was a class method instead of an instance method:
SEL mySelector; mySelector = @selector(stringForDate:usingFormatter:); NSMethodSignature * sig = nil; sig = [self methodSignatureForSelector:mySelector]; NSInvocation * myInvocation = nil; myInvocation = [NSInvocation invocationWithMethodSignature:sig]; [myInvocation setTarget:[self class]]; // <-- will this work? [myInvocation setSelector:mySelector];
and the rest given as above?
Best,
Dalmazio