Repository navigation
fix(metagen): keep typedef'd CF types for block parameters - #116
Open
NathanWalker wants to merge 4 commits into
Open
NathanWalker wants to merge 4 commits into
NathanWalker wants to merge 4 commits into
Conversation
This was referenced Nov 7, 2026
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
ammarahm-ed
force-pushed
the
android-react-native
branch
2 times, most recently
from
November 8, 2026 12:59
4f87f05 to
9633aba
Compare
Block parameter types were read from the canonical function type, which drops typedef sugar: CMSampleBufferRef became struct opaqueCMSampleBuffer * and lost its CF bridging, so CF block parameters were emitted as raw pointers. Read them from the declared block type instead, falling back to the canonical type if the arity differs.
Xcode 27 no longer builds for iOS deployment targets below 15.0, so the device and simulator builds of NativeScript.xcframework fail at 13.0.
Match the 15.0 deployment target in NativeScript/CMakeLists.txt: the React Native podspec, the iOS app template, the libffi build and the test runner's TKLiveSync stub.
NathanWalker
force-pushed
the
fix/metagen-block-param-typedefs
branch
from
November 20, 2026 21:24
2ba50c2 to
000be56
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #103 (part 3).
Summary
The metadata generator read block parameters from the block's canonical type, which has lost its parameters' typedef names (
CMSampleBufferRefbecomesstruct opaqueCMSampleBuffer *) and with them the CF bridging. Block parameters are now read from the declared (sugared) block type, the same way function, method and delegate parameters already are.It falls back to the canonical type if the sugared type isn't a block pointer or its arity differs. Neither fallback fires on the current iOS or macOS SDK. C function-pointer callbacks (e.g.
CFRunLoopObserverCallBack) are unchanged and still read the canonical type.Also raises the iOS deployment target from 13.0 to 15.0, in two separate commits. Xcode 27 can't build below 15.0, so without this the iOS run above can't build at all. The change covers the device and simulator targets in
NativeScript/CMakeLists.txt, the React Native podspec (and its copy inscripts/test_react_native_ffi_compat.sh), the iOS app template, the libffi build flags and the test runner's TKLiveSync stub. The checked-in libffi archives were built for 13.0 and still link into a 15.0 target.The generator is shared, so NativeScript iOS apps change too on the next regen:
CMSampleBufferRef,CGImageRef,CVImageBufferRef,CFErrorRef,SecTrustRef,CFArrayRef, …) arrive in JS as bridged objects instead ofinterop.Pointer/Reference. ACFStringRefnow arrives as a JS string.interop.PointerConvertibletointerop.Object(AVFoundation, CoreMedia, VideoToolbox, Security, CoreText, ImageIO, ReplayKit…). Generic collection blocks (NSArray.enumerateObjectsUsingBlock,NSDictionary.enumerateKeysAndObjectsUsingBlock, diffable data sources…) are now typed with the class's type parameter, a TypeScript-only change that defaults tointerop.Object..add(),.toNumber(),new interop.Reference(type, ptr), or manualCFRetain/CFReleaseof the callback argument.PointerConvertible→ObjectObject→ type parameterconst T[]params typedinterop.Pointer(binary unchanged), andSecTransformSetTransformAction's block now returnsinterop.ObjectExamples:
AVCaptureStillImageOutput.captureStillImageAsynchronouslyFromConnectionCompletionHandler(CMSampleBufferRef),AVAssetImageGenerator.generateCGImagesAsynchronouslyForTimesCompletionHandler(CGImageRef),RPScreenRecorder.startCaptureWithHandlerCompletionHandler(CMSampleBufferRef),SecTrustEvaluateAsyncWithError(SecTrustRef, CFErrorRef).Base and new typings type-check with the same
tscerrors (5.6.3), so nothing new.Relation to #115: the VideoToolbox output-handler case from #103 only queues once metadata is regenerated with this change. With current metadata its
CMSampleBufferRefparameter is a raw pointer, so the callback keeps waiting for JS.Evidence
Both generators went through the same clean pipeline: metadata,
GeneratedSignatureDispatch.incand the TestRunner app metadata were all regenerated, with no checked-in metadata involved.npm run test:macosnpm run test:ios(simulator)The 8 iOS failures are all double/Float64 cases (
FunctionWithDouble1,StaticMethodWithDouble1,InstanceMethodWithDouble1,DerivedMethodWithDouble1,functionWithDoublePtr,functionWithFloat64ArrayBuffer,functionWithFloat64ArrayBufferView,NSInvocation_methodWithDouble1), present on the base generator too. The iOS simulator build needs the deployment-target bump below to build under Xcode 27.1.New regression test in
Marshalling/ObjCTypesTests.js("Block parameters with CF typedefs are marshalled as objects", viaCGImageMetadataEnumerateTagsUsingBlock): passes with this generator on both the napi bridge (MACOS_TEST_FFI_BACKEND=napi, 717 tests, 0 failures) and the default V8 bridge (717 tests, 0 failures). It fails with the base generator, wherepatharrives as aninterop.Reference. iOS was not re-run after adding the test.Merge Danger
Door: one-way for apps (typings and runtime values change on regen)
Blast Radius: every iOS/macOS app that regenerates metadata and uses CF-typed block parameters.