> All I want is to recursively enumerate a dictionary that can contain dictionary
> to a list like
> "dictionarykey" = "value"
> "key" = "value"
> "key.subkey" = "value"
> ...
>
> Why cam't Apple document how to get what type a dictionary value is?
What prevented you from finding the CFGetTypeID function?
/Bo Lindbergh
> All I want is to recursively enumerate a dictionary that can contain
> dictionary
> to a list like
> "dictionarykey" = "value"
> "key" = "value"
> "key.subkey" = "value"
> ...
>
> Why cam't Apple document how to get what type a dictionary value is?
Because they already documented the general case:
- [NSObject isKindOfClass:]
and
- [NSbject respondsToSelector:]
usually, one writes this as:
void DictRecurse(NSDictionary *dict) {
NSEnumerator *keys = [dict keyEnumerator];
id key;
while(nil != (key = [keys nextObject])){
id value = [dict objectForKey:key];
if ([id respondsToSelector:@selector(objectForKey:)]) {
DictRecurse(id);
}
}
}