I'm using CFPropertyListCreateDeepCopy
to make a deep mutable copy of an NSDictionary
. This example works fine.
NSDictionary *test = @{@"1": @"One"};
NSMutableDictionary *dictionary = (__bridge NSMutableDictionary *)CFPropertyListCreateDeepCopy(NULL, (__bridge CFDictionaryRef)test, kCFPropertyListMutableContainersAndLeaves);
This doesn't work when the NSDictionary
uses an NSNumber
for a key value. CFPropertyListCreateDeepCopy
returns nil
. Here is an example.
NSDictionary *test = @{@(1): @"One"};
NSMutableDictionary *dictionary = (__bridge NSMutableDictionary *)CFPropertyListCreateDeepCopy(NULL, (__bridge CFDictionaryRef)test, kCFPropertyListMutableContainersAndLeaves);
How do I make a deep copy of an NSDictionary
that has an NSNumber
as a key value?