views:

91

answers:

1

To, for example, access variables in a NSDictionary Cocoa frameworks often define keys, such as UIKeyboardBoundsUserInfoKey. How can I check if a key is defined at runtime? I found examples on how to check for classes and functions, but not for constants.

+8  A: 

Check it's pointer against nil, like this

if (&UIKeyboardBoundsUserInfoKey != nil)
{
    //Key exists
}
Jasarien
Thanks, works great.
Johan Kool