> Kind of surprised to discover that NSMapTable doesn’t exist on iOS (even the 
> older procedural form of the API). I need a non-retaining dictionary — do I 
> need to drop down to CFDictionary or is there some higher-level alternative?

I was surprised by this too, but found the CFDictionary alternative palatable:

    // weak opaque-pointer keys
    // strong object values
    NSMutableDictionary *b = (id)CFDictionaryCreateMutable(nil, 0,
nil, &kCFTypeDictionaryValueCallBacks);

    // strong object keys
    // weak opaque-pointer values
    NSMutableDictionary *a = (id)CFDictionaryCreateMutable(nil, 0,
&kCFTypeDictionaryKeyCallBacks, nil);

    // weak opaque-pointer keys
    // weak opaque-pointer values
    NSMutableDictionary *c = (id)CFDictionaryCreateMutable(nil, 0, nil, nil);

Unfortunately the NSMapTable omission means code that's shared between
iOS and OS X can't take advantage of zeroing weak references in the OS
X GC case, but perhaps that's a limited use case.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to