Struggle with that. Hoping this is possible and I don't look stupid.
I am hacking forwardInvocation in the class I am writing. What I want to do is redirect the call to one selector or another, depending on whether it is an object or a primitive type. My ultimate goal is to “insert” primitives so that they can be added to arrays / dictionaries. For simplicity, the two types of values that usually go here are NSStrings and enumerations.
In short, given a pointer, is there a way to determine if this is an object?
__unsafe_unretained id argument;
[anInvocation getArgument:&argument atIndex:2];
if (![argument isKindOfClass:[NSObject class]]) {
...
}
Is there a test that I can run? Now my hacker code does this nasty trick:
if ((NSInteger)argument < 10) {
...
}
Thanks in advance.