I have an object, suppose of class A, and it has a string stored in it. I want to type-cast it into NSString object. Basically this is what I want to achieve:
NSString *temp = (NSString *)[A someMEthod];
if(temp isMemberOfClass : [NSString class]) {
dosomething
}
Can somebody tell me how to achieve this?
If you want to check an object if it is of certain class (in runtime), use this:
Your question isn’t exactly cleat, it seems your best option is to make the “string stored in the object” be a property with the type of NSString already, so you wouldn’t have to do any type casts and checks at all.