One point of the discussion is that there is no need to do this, and things you think you might want to do the test for are probably invalid.

But, if you wanted to test, you could see if the instance you have isKindOfClass:[NSCFArray class]. However, this would be fragile, since "NSCFArray" is not in the public API, and just an implementation detail. You could try something like

CFArrayRef cfArray = CFArrayCreate(NULL, NULL, 0, &kCFTypeArrayCallBacks); // Create a temp CFArray
  Class cfArrayClass = [(id)cfArray class];     // Get its class
  CFRelease(cfArray);
return ([array isKindOfClass: cfArrayClass]); // See if your array happens to be an instance of the same class (or is a subclass)

...but even this may be fragile and not guaranteed to get you the result you were expecting. I'd really recommend finding a solution that doesn't require this test. The transparency of toll-free bridging should be enough for almost anything you need to do with CF or NSArrays "on the other side." (Except for those CFArrays which were created with custom callbacks, which should never be treated as NSArrays.)

Ali


On Apr 2, 2009, at 6:27 PM, Greg Guerin wrote:

Despite each side presenting its own test that proves its own case, may I suggest answering the OP's question:

http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg00082.html

The conditions seem pretty clear to me.

Last one to the garden gate is a rotten egg. ;-)

 -- GG

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to