implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC

21,281

Solution 1

You can't do implicit casts to void* anymore, 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. In modern code the correct answer is that provided by @KazukiSakamoto, AudioSessionInitialize(NULL, NULL, NULL, (__bridge void*)self);

Solution 2

You should use __bridge cast for it.

AudioSessionInitialize(NULL, NULL, NULL, (__bridge void *)self);
Share:
21,281
Ali
Author by

Ali

I love to build things that people love to use. I like scientific data analysis. I've spent most of my life in medicine and neuroscience! I like: vim, zsh, golang, debian, python I am addicted to writing code! and learning new things!!

Updated on July 26, 2020

Comments

  • Ali
    Ali almost 4 years

    What does this mean and what alternative do I have?

    implicit conversion of an Objective-C pointer to 'void *' is disallowed with ARC

    I am porting an Xcode3 project to iOS5 which uses AudioSessionInitialize like this

    AudioSessionInitialize(NULL, NULL, NULL, self);
    

    where self here is a ViewController.