Search code examples
iphoneiosxcodeaudio-streamingaudiostreamer

Audiostreamer iOS class - ARC error


I'm trying to implement Matt Gallagher's AudioStreamer class and I'm getting 20+ errors on Audiostream.m file that are basically reading:

Cast of C pointer type 'void *' to Objective-C pointer type 'AudioStreamer *' requires a bridged cast

I'm new to iOS. I know what ARC is, but what does this error mean?


Solution

  • as the error suggests you need a bridged cast. Please read that question for the differences between the available bridged casts. And if you have time watch WWDC 2011 session 323.


    You probably just need something like this:

    AudioSessionInitialize (
        NULL,                          // 'NULL' to use the default (main) run loop
        NULL,                          // 'NULL' to use the default run loop mode
        MyAudioSessionInterruptionListener,  // a reference to your interruption callback
        (__bridge void *)(self)                       // data to pass to your interruption listener callback
    );