I got this error, and as I program xcode only at my house, I have no resources to quickly ask even the most simple 10 second questions. So this is one that came up today, I am using the AudioSessionAddPropertyListener function, and I get this warning:
passing 'CFTypeRef' (aka 'const void ) to parameter of type 'void' discards Qualifiers
from this line of code.
// Registers the audio route change listener callback function
// An instance of the audio player/manager is passed to the listener
AudioSessionAddPropertyListener ( kAudioSessionProperty_AudioRouteChange,
audioRouteChangeListenerCallback, CFBridgingRetain(self) );
then definition of the AudioSessionAddPropertyListener is
AudioSessionAddPropertyListener( AudioSessionPropertyID inID,
AudioSessionPropertyListener inProc,
void *inClientData)
and I see the *inClientData variable appears to be of type void (Or maybe not)
So what exactly might be the problem here, Mostly I would like to know what to look for when trouble shooting. I don't know what I don't know.
thanks
Steve
I'm not at 50 yet so I can't comment:
I looked at the definition of CFBridgingRetain it takes ID, and returns CFTypeRef
NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) {
return (__bridge_retained CFTypeRef)X;
}
Now the definition of CFTypeRef is void /* Base "type" of all "CF objects", and polymorphic functions on them */ typedef const void * CFTypeRef;
so in order to drop the warning I did this, cast the output of the function as (void *)
AudioSessionAddPropertyListener ( kAudioSessionProperty_AudioRouteChange,
audioRouteChangeListenerCallback, (void *) CFBridgingRetain(self) );
Does anyone see an issue with this?