I’m trying to achieve [NSMutableDictionary dictionaryWithObjects:frames forKeys:items] but with a CFDictionary so I have control over the key and value callbacks. This is what I’ve got:
__unsafe_unretained id keys[itemCount];
[items getObjects:keys range:NSMakeRange(0, itemCount)];
__unsafe_unretained id values[itemCount];
[frames getObjects:values range:NSMakeRange(0, itemCount)];
CFDictionaryCreate(kCFAllocatorDefault, (const void **)keys, (const void **)values, itemCount, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
Which gives the following error: Cast of an indirect pointer to an Objective-C pointer to 'const void **' is disallowed with ARC.
I’ve tried various permutations of bridging, but I can’t seem to get it to compile without complaint.
Any help much appreciated!
I haven’t been able to find a syntax for that either. (EDIT: Justin’s answer has the syntax.) Try this instead:
Then you don’t need a cast when you call
CFDictionaryCreate.