开发者

Automatic Retain Count, AVFoundation: Dictionary containing non objective C objects. How do do this with ARC?

I am actually converting some of my source files to ARC. ARC is very nice, saves time and memory leaks. Actually I'm trying to convert my AVFoundation code and reached my limits at one very special line of code:

image = [CIImage imageWithCVPixelBuffer:pixelBuffer options:[NSDictionary dictionaryWithObject:colorSpace forKey:kCIImageColorSpace]];

"colorspace" is type of CGColorSpaceRef aka开发者_如何学JAVA CGColorSpace*. CGColorSpace is a struct and cannot be converted into id. I am very surprised about this, because the code always worked for me (the colorspace is being used by CIImage correctly). I cannot run the compiler using ARC, because the colorspace is not an objective C object. The compiler (using ARC) refuses adding the colorspace into the dictionary.

Does anyone know how to replace the "colorspace" inside this dictionary, or how to tell the compiler, that it's okay using this colorspace pointer?


Use a CFDictionaryRef using CFDictionaryCreate() instead of an NSDictionary and then cast it to an NSDictionary using (__bridge_transfer NSDictionary *)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜