I got this from the docs of makeObjectsPerformSelector
and this is the description of the parameter SEL
in this method
A selector that identifies the message to send to the objects in the array. The method must take a single argument of type id, and must not have the side effect of modifying the receiving array.
Then I run this line
[self.topInFriends makeObjectsPerformSelector:@selector(setHidden:)
withObject:@"Fcuked up"];
It hides the button, So it doesn't matter what you are passing. And it makes sense too as your method expect a BOOL
and you are giving an object to it, I don't know the exact internal implementation of makeObjectsPerformSelector
but I can conclude some points
When you pass some object say @"abc"
or @YES
and when makeObjectsPerformSelector
invokes your setHidden
then it's passing object, which obviously has some address too, to setHidden
and it converts your object(address) into BOOL
.
Suppose your addresses are
@"Fcuked up" ---> 0x7cde450034798976 (assuming 64 bit pointer)
@YES ---> 0x7cde450000000000
For first case the value of BOOL
will become true as it's LSB are non-zero and for second case the BOOL
will become false as LSB are zeros.
In whole you should respect apple docs and you should not call a method which doesn't take parameter as id
All thoughts appearing in this answer are mine. Any resemblance to other persons, living or dead, is purely coincidental.