Inspecting elements of Cocoa object in ASOC

Hello all.

Rather than ask to see what the elements of a particular object is, which would help me only, I was wondering if there was a way of showing the elements of any object, which would possibly help others as well

My context is:

I’m getting available WiFi networks as an object, but don’t know what to do with it

related to: http://macscripter.net/viewtopic.php?id=43568

Cocoa objects don’t have elements…

Hey Shane

I think this post was a little in desperation

However, I remembered something from a post a while ago

set networkNames to networks's valueForKey_("ssid")'s allObjects() as list

You do need to know the keys within the object, but these are normally available from Apple, for example:

https://developer.apple.com/library/mac/documentation/CoreWLAN/Reference/CWInterface_reference/#//apple_ref/doc/uid/TP40010960-CLSCHCWInterface-DontLinkElementID_46

the “keys” are actually the properties of the object.
valueForKey isn’t a good example, because in this particular meaning it’s only available for an array of dictionaries or key-value compliant objects.

For Cocoa programming it’s mandatory to read the documentation to get use to the properties and methods of the classes