tags:

views:

19

answers:

1

Hi, i´ve searched the xcode doku but didn´t found anything about logging the datatype of a variable. How can i trace the typeof ?

Thanks

A: 

Duplicate of: http://stackoverflow.com/questions/536396/in-objective-c-what-is-the-equivelant-of-the-java-instanceof-keyword

Summary:

Try [myObject class] for returning the class of an object.

You can make exact comparisons with:

if ([myObject class] == [MyClass class])

but not by using directly MyClass identifier.

Similarily, you can find if the object is of a subclass of your class with:

if ([myObject isKindOfClass:[AnObject class]])

as suggested by Jon Skeet and zoul.

Kalle
Oh nice, thanks for your fast reply. Solved
geforce