0
votes

I'm trying to convert some Apple code (from SquareCam example) to ARC. I had the Apple code flagged to compile as non-ARC and it worked but I was getting crash errors passing images between the non-ARC context to an ARC context - so I'm trying to resolve that.

Anyway, I think I have got all the ARC stuff handled except for this line:

 NSNumber *orientation = CMGetAttachment(imageDataSampleBuffer, kCGImagePropertyOrientation, NULL);

This is used for the CIDetectorImageOrientation key value (CoreImage face detection). I get the ARC error below for this and none of the stuff I have tried resolves this. "imageDataSampleBuffer" is of type CMSampleBufferRef.

What is the correct way to convert the CFTypeRef to the NSNumber I need? - Thanks!

Implicit conversion of a non-Objective-C pointer type 'CFTypeRef' (aka 'const void *') to 'NSNumber *' is disallowed with ARC

1

1 Answers

1
votes

Because you are assigning a CFTypeRef to an NSObject*, the compiler complains. You need to do a __bridge to an NSNumber.