CoreFoundation => Foundation

iconara

Registered
I have a CFDictionaryRef and want to make a NSDictionary out of it. Any suggestions on how to do it? The manual way is a possibility, but I rather have a nice little method somewhere, like +dictionaryWithCFDictionayRef: ... both the CoreFoundation and Foundation documentation seems to avoid this topic.




theo/iconara
 
it's a pity having to answer one's own questions...

this is the way to do it:

Code:
CFDictionaryRef cfDict = CFDictionaryCreate(...);
NSDictionary *nsDict = (NSDictionary *)cfDict;

It's actally possible to cast one type to the other. This will result in a compiler warning, but one can just ignore that....


Ugly.
 
That's why they call it "toll free bridging" you just cast the type (you shouldn't get any warnings: never got one).
 
Back
Top