ARRK! ARC错误:不允许'CFTypeRef'(又名'const void *')到'NSNumber *' [英] Arrk! ARC error:'CFTypeRef' (aka 'const void *') to 'NSNumber *' is disallowed

查看:99
本文介绍了ARRK! ARC错误:不允许'CFTypeRef'(又名'const void *')到'NSNumber *'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些Apple代码(从 SquareCam 示例)转换为ARC。我将Apple代码标记为非ARC编译并且它有效但我在非ARC上下文之间传递图像时遇到崩溃错误 - 所以我正试图解决这个问题。

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.

无论如何,我想我已经处理了除此行之外的所有ARC内容:

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

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

这用于 CIDetectorImageOrientation 键值(CoreImage人脸检测)。我在下面得到了ARC错误,我尝试过的所有内容都没有解决这个问题。 imageDataSampleBuffer的类型为 CMSampleBufferRef

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.

将CFTypeRef转换为我需要的NSNumber的正确方法是什么? - 谢谢!

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


非Objective-C指针类型'CFTypeRef'的隐式转换(又名
'const void *' )'NSNumber *'不允许使用ARC

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


推荐答案

因为您要分配CFTypeRef到一个NSObject *,编译器抱怨。您需要对NSNumber执行 __ bridge

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

这篇关于ARRK! ARC错误:不允许'CFTypeRef'(又名'const void *')到'NSNumber *'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆