Hi all - I think it's impossible to use `AVCapture...
# ios
m
Hi all - I think it's impossible to use
AVCaptureVideoDataOutputSampleBufferDelegateProtocol
because both its method definitions are the same, just with different names:
Copy code
public expect interface AVCaptureVideoDataOutputSampleBufferDelegateProtocol : platform.darwin.NSObjectProtocol {
    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun captureOutput(output: platform.AVFoundation.AVCaptureOutput, didOutputSampleBuffer: kotlinx.cinterop.CPointer<cnames.structs.opaqueCMSampleBuffer>? /* from: platform.CoreMedia.CMSampleBufferRef? */, fromConnection: platform.AVFoundation.AVCaptureConnection): kotlin.Unit { /* compiled code */ }

    @kotlin.commonizer.ObjCCallable @kotlinx.cinterop.ObjCMethod public open expect fun captureOutput(output: platform.AVFoundation.AVCaptureOutput, didDropSampleBuffer: kotlinx.cinterop.CPointer<cnames.structs.opaqueCMSampleBuffer>? /* from: platform.CoreMedia.CMSampleBufferRef? */, fromConnection: platform.AVFoundation.AVCaptureConnection): kotlin.Unit { /* compiled code */ }
}
When I try to implement it, I get the following error:
Copy code
object : NSObject(), AVCaptureVideoDataOutputSampleBufferDelegateProtocol {
        override fun captureOutput(
            output: AVCaptureOutput,
            didOutputSampleBuffer: CMSampleBufferRef?,
            fromConnection: AVCaptureConnection
        ) {
            super.captureOutput(output, didOutputSampleBuffer, fromConnection)
        }
    }
Copy code
The corresponding parameter in the supertype 'AVCaptureVideoDataOutputSampleBufferDelegateProtocol' is named 'didDropSampleBuffer'. This may cause problems when calling this function with named arguments.
d
For Kotlin 2.0+, use the @ObjCSignatureOverride annotation to suppress warnings about K/N Objective-C overloads. If you're on an older version (1.9.20 or earlier), use @Suppress("CONFLICTIONG_OVERLOADS")
m
But since both methods are identical except for the parameter name, how can I call one of them from Kotlin?