I am using performSelector: which returns an id object to call several other methods. The return type of these methods can be either BOOL , int , NSDate , or any other kind of object.
How can I find out if an object is returned from performSelector: BOOL or not? I tried converting it to NSNumber , etc., but it will work if the object is not BOOL .
I have a class with attributes such as:
@property(retain,nonatomic) NSString* A; @property(assign,nonatomic) BOOL B; @property(retain,nonatomic) NSArray* C; @property(assign,nonatomic) int64_t D;
This class is generated by the framework, so I cannot change it. But I want to iterate over A , B , C , D to call each attribute and retrieve the data. However, as you can see, the type of return may vary, and I need to adapt to this.
I am doing something similar to:
SEL s = NSSelectorFromString(@"A"); id obj = [object performSelector:s]; //check if obj is BOOL //do something with obj
source share