[英]implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC
What does this mean and what alternative do I have?这是什么意思,我有什么选择?
implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC
ARC 不允许将 Objective-C 指针隐式转换为“void *”
I am porting an Xcode3 project to iOS5 which uses AudioSessionInitialize like this我正在将一个 Xcode3 项目移植到 iOS5,它像这样使用 AudioSessionInitialize
AudioSessionInitialize(NULL, NULL, NULL, self);
where self
here is a ViewController.这里的
self
是一个 ViewController。
You should use __bridge cast for it.你应该使用 __bridge cast 。
AudioSessionInitialize(NULL, NULL, NULL, (__bridge void *)self);
You can't do implicit casts to void*
anymore, AudioSessionInitialize(NULL, NULL, NULL, objc_unretainedPointer(self));
你不能再对
void*
进行隐式转换了, AudioSessionInitialize(NULL, NULL, NULL, objc_unretainedPointer(self));
should do the trick.应该做的伎俩。
EDIT: Historical point, the answer above was from before the __bridge
casts were finalized.编辑:历史观点,上面的答案来自
__bridge
演员表最终确定之前。 In modern code the correct answer is that provided by @KazukiSakamoto, AudioSessionInitialize(NULL, NULL, NULL, (__bridge void*)self);
在现代代码中,正确答案是@KazukiSakamoto,
AudioSessionInitialize(NULL, NULL, NULL, (__bridge void*)self);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.