An example casing objects sent with an ID to the class they actually are NSInteger MyCompareFunction(id arg1, id arg2, void *arg3) { return [[(MyClassName *)arg1 SomeObjectInClass] compare: [(MyClassName *)arg2 SomeObjectInClass]]; }