Implicit type conversion of an Objective-C pointer. Cast bridge issue

I get the following error:

"Implicit conversion of Objective-C pointer type. Type "void*" requires a bridged cast. 

I installed similar bits of code with bridges - but these types of fixes do not help here. Here's the code bit:

 AURenderCallbackStruct input; input.inputProc = RenderTone; input.inputProcRefCon = self; err = AudioUnitSetProperty( toneUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(input)); NSAssert1(err == noErr, @"Error setting callback: %ld", err); 

Second bit of error code

 SStatus result = AudioSessionInitialize(NULL, NULL, ToneInterruptionListener, self); if (result == kAudioSessionNoError) { UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; AudioSessionSetProperty( kAudioSessionProperty_AudioCategory, sizeof(sessionCategory), &sessionCategory); } 

Thanks in advance for your help.

Update

The problem is resolved. Casting of the bridge was carried out incorrectly. It should have been:

  input. inputProcRefCon = (__bridge void*)self 
+6
source share

Source: https://habr.com/ru/post/915099/


All Articles