Objective c 我应该从CGImageSourceCopyPropertiesAtIndex调用中释放返回对象吗?
Objective c 我应该从CGImageSourceCopyPropertiesAtIndex调用中释放返回对象吗?,objective-c,Objective C,CGImageSourceCopyPropertiesAtIndex函数的文档中没有说明。但是我应该在returedCFDictionaryRef上调用CFRelease对吗 快速样本: NSDictionary* metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL); ...................... //Should i call CFRelease(metadata); ??
CGImageSourceCopyPropertiesAtIndex
函数的文档中没有说明。但是我应该在returedCFDictionaryRef
上调用CFRelease
对吗
快速样本:
NSDictionary* metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
......................
//Should i call CFRelease(metadata); ??
谢谢。是的,你应该发布它。
文档中没有这样说,因为这是一个普遍的惯例。函数名为
Copy
或Create
返回的每个对象都归您所有,完成后应将其释放。对于GC,您也可以这样做:
(NSDictionary *)NSMakeCollectable( CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, (CFDictionaryRef)options) );
谢谢,我只是对许多CGImageCreate函数显式地声明它感到困惑。