Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 我应该从CGImageSourceCopyPropertiesAtIndex调用中释放返回对象吗?_Objective C - Fatal编程技术网

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
函数的文档中没有说明。但是我应该在retured
CFDictionaryRef
上调用
CFRelease
对吗

快速样本:

NSDictionary* metadata = (NSDictionary   *)CGImageSourceCopyPropertiesAtIndex(source,0,NULL);
......................
//Should i call CFRelease(metadata); ??
谢谢。

是的,你应该发布它。
文档中没有这样说,因为这是一个普遍的惯例。函数名为
Copy
Create
返回的每个对象都归您所有,完成后应将其释放。

对于GC,您也可以这样做:

(NSDictionary *)NSMakeCollectable( CGImageSourceCopyPropertiesAtIndex(sourceRef, 0, (CFDictionaryRef)options) );

谢谢,我只是对许多CGImageCreate函数显式地声明它感到困惑。