CFArrayRef和NSArray

CFArrayRef和NSArray是toll-free bridged的,互用都没有问题。如下:

NSString *values[] = {@"hello", @"world"};
CFArrayRef arrayRef = CFArrayCreate(kCFAllocatorDefault, (void *)values, (CFIndex)2, NULL);
NSArray *array = (NSArray *)arrayRef;
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array];

posted on 2012-06-08 17:33  麦克煎蛋  阅读(1025)  评论(0编辑  收藏  举报