我使用以下CoreFoundation
函数CFPropertyListCreateDeepCopy:
将不可变对象转换为可变对象.如果任何对象为NULL,则CFPropertyListCreateDeepCopy
返回空.是否有任何解决方法.
self.packageArray = CFBridgingRelease(CFPropertyListCreateDeepCopy(NULL, (CFPropertyListRef)self.packageArray , kCFPropertyListMutableContainersAndLeaves));
CFPropertyListCreateDeepCopy无法处理包含NSNull的数组/字典
示例代码
NSArray *immutable = @[ @"a", [NSNull null], @"c" ]; NSMutableArray *mutable = (__bridge id)CFPropertyListCreateDeepCopy(kCFAllocatorDefault, (__bridge CFArrayRef)immutable, kCFPropertyListMutableContainers);
来自此链接的示例json响应
提前致谢.