dav*_*idm 5 cocoa core-foundation ios automatic-ref-counting
我不清楚以下内存管理含义:
NSDictionary* props = (__bridge NSDictionary*) CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
Run Code Online (Sandbox Code Playgroud)
由于该CGImageSourceCopyPropertiesAtIndex
函数在名称中具有Copy,因此我拥有CFDictionaryRef并且必须将其释放.但是,既然它被投了一个NSDictionary
,我就不能打电话了[props release]
.什么是对待这个的正确方法?
使用CFBridgingRelease
的所有权转移到ARC
CFDictionaryRef cfDict = CGImageSourceCopyPropertiesAtIndex(imageSource, 0, NULL);
NSDictionary *dict = (NSDictionary *)CFBridgingRelease(cfDict);
Run Code Online (Sandbox Code Playgroud)
否则你需要在CFRelease
完成字典后调用.
归档时间: |
|
查看次数: |
1378 次 |
最近记录: |