Type mismatch in overrides in AVFoundation generation
While experimenting with FFI using AVFoundation, using this config:
headers:
entry-points:
- '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFoundation.framework/Versions/A/Headers/AVFoundation.h'
exclude-all-by-default: true
objc-interfaces:
include:
- 'AVAudioSession'
- 'AVPlayer'
globals:
include:
- 'AVAudioSessionCategoryPlayback'
- 'AVAudioSessionCategoryOptionMixWithOthers'
I got the following related errors in the generated output:
-
'AVFragmentedAsset.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVFragmentedAssetTrack_NSError)') isn't a valid override of 'AVAsset.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVAssetTrack_NSError)'). -
'AVComposition.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVCompositionTrack_NSError)') isn't a valid override of 'AVAsset.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVAssetTrack_NSError)'). -
'AVMutableComposition.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVMutableCompositionTrack_NSError)') isn't a valid override of 'AVComposition.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVCompositionTrack_NSError)'). -
'AVMovie.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVMovieTrack_NSError)') isn't a valid override of 'AVAsset.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVAssetTrack_NSError)'). -
'AVMutableMovie.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVMutableMovieTrack_NSError)') isn't a valid override of 'AVMovie.loadTrackWithTrackID_completionHandler_' ('void Function(int, ObjCBlock_ffiVoid_AVMovieTrack_NSError)').
It looks like the issue is that generated block type is a unique type based on the combination of all of the individual parameter types, but the subclasses are using subclasses in one of the block parameter types and so the generated types don't match.
(I'm not trying to use this set of APIs so I can probably trim this out to unblock myself, but I wanted to file it since it's making output that doesn't compile from standard iOS SDK headers.)
Makes sense. I'll need to think about how to reflect the inheritance rules in the block type. Maybe have the generated block implement an interface that takes the signature as a generic param, then take that interface in these methods: https://dartpad.dev/?id=f987590bbdc4e04fbd24b850a70086ba