From e190a8c2a1c4209579cbc0fbd0336848aa722c7e Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sat, 7 Nov 2026 11:29:17 -0800 Subject: [PATCH 1/4] fix(metagen): keep typedef'd CF types for block parameters 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. --- metadata-generator/src/IR/TypeSpec.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/metadata-generator/src/IR/TypeSpec.cpp b/metadata-generator/src/IR/TypeSpec.cpp index 33b7fe1e5..2132f1048 100644 --- a/metadata-generator/src/IR/TypeSpec.cpp +++ b/metadata-generator/src/IR/TypeSpec.cpp @@ -15,6 +15,29 @@ static const std::unordered_set KNOWN_BRIDGED_TYPES = { namespace metagen { +// The canonical function type of a block has lost its parameters' typedef +// names (CMSampleBufferRef becomes struct opaqueCMSampleBuffer *), and with +// them the CF bridging, so parameters are read from the sugared type. +static CXType sugaredBlockFunctionType(CXType type, CXType canonicalPointee) { + while (type.kind != CXType_BlockPointer) { + if (type.kind == CXType_Typedef) { + type = clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(type)); + } else if (type.kind == CXType_Attributed) { + type = clang_Type_getModifiedType(type); + } else if (type.kind == CXType_Elaborated) { + type = clang_Type_getNamedType(type); + } else { + return canonicalPointee; + } + } + + CXType pointee = clang_getPointeeType(type); + if (clang_getNumArgTypes(pointee) != clang_getNumArgTypes(canonicalPointee)) { + return canonicalPointee; + } + return pointee; +} + TypeSpec::TypeSpec(CXType type, std::vector* classTypeParameters) { auto canonicalType = clang_getCanonicalType(type); @@ -176,7 +199,8 @@ TypeSpec::TypeSpec(CXType type, std::vector* classTypeParameters) { break; case CXType_BlockPointer: { - auto pointeeType = clang_getPointeeType(canonicalType); + auto pointeeType = + sugaredBlockFunctionType(type, clang_getPointeeType(canonicalType)); auto resultType = clang_getResultType(pointeeType); callbackReturn = std::make_shared(resultType, classTypeParameters); From 9f7f6a2602b7586d278fa8ff4fcfb09b2ce15595 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sat, 7 Nov 2026 11:53:26 -0800 Subject: [PATCH 2/4] test(metagen): cover CF typedef block parameters --- .../app/tests/Marshalling/ObjCTypesTests.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js b/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js index eafc0bc49..feecf28a4 100644 --- a/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js +++ b/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js @@ -201,6 +201,23 @@ describe(module.id, function () { expect(actual).toBe("complex block called\nTNSObjCTypes"); }); + it("Block parameters with CF typedefs are marshalled as objects", function () { + var metadata = CGImageMetadataCreateMutable(); + expect(CGImageMetadataSetValueWithPath(metadata, null, "xmp:CreatorTool", "NativeScript")).toBe(true); + + var calls = []; + CGImageMetadataEnumerateTagsUsingBlock(metadata, null, null, function (path, tag) { + calls.push({ path: path, tag: tag }); + return true; + }); + + expect(calls.length).toBe(1); + expect(calls[0].path instanceof interop.Pointer).toBe(false); + expect(calls[0].path instanceof interop.Reference).toBe(false); + expect(calls[0].path).toBe("xmp:CreatorTool"); + expect(String(CGImageMetadataTagCopyName(calls[0].tag))).toBe("CreatorTool"); + }); + it("MethodWithBlockReturn", function () { var block = TNSObjCTypes.alloc().init().methodWithBlockScope(4); //expect(block.length).toBe(3); From 8da61e50b4972a99087d6233a3a8b7b700262e63 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sat, 7 Nov 2026 13:50:57 -0800 Subject: [PATCH 3/4] build(ios): raise the iOS deployment target to 15.0 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. --- NativeScript/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NativeScript/CMakeLists.txt b/NativeScript/CMakeLists.txt index 9bcd878fb..cbf01989e 100644 --- a/NativeScript/CMakeLists.txt +++ b/NativeScript/CMakeLists.txt @@ -37,10 +37,10 @@ if (BUILD_MACOS_NODE_API) endif() if(TARGET_PLATFORM STREQUAL "ios") - set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "13.0") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "15.0") set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") - set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0") + set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0") set(LIBFFI_BUILD "iphoneos-arm64") set(TARGET_PLATFORM_IOS TRUE) set(SDK_NAME "iphoneos") @@ -48,10 +48,10 @@ if(TARGET_PLATFORM STREQUAL "ios") set(TARGET_PLATFORM_SPEC "ios-arm64") elseif(TARGET_PLATFORM STREQUAL "ios-sim") - set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "13.0") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "15.0") set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") - set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0") + set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0") set(LIBFFI_BUILD "iphonesimulator-universal") set(TARGET_PLATFORM_IOS TRUE) set(TARGET_PLATFORM_SIM TRUE) From 000be56faf88197837379e63e4a6867d85282d06 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Sat, 7 Nov 2026 13:57:18 -0800 Subject: [PATCH 4/4] build(ios): raise the remaining iOS 13.0 targets to 15.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. --- .../ios/__PROJECT_NAME__.xcodeproj/project.pbxproj | 4 ++-- scripts/build_libffi.js | 6 +++--- scripts/run-tests-ios.js | 4 ++-- scripts/test_react_native_ffi_compat.sh | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj b/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj index 142e4274c..19e28656f 100644 --- a/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj +++ b/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj @@ -353,7 +353,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; STRIP_SWIFT_SYMBOLS = NO; @@ -407,7 +407,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; SDKROOT = iphoneos; STRIP_SWIFT_SYMBOLS = NO; SUPPORTS_UIKITFORMAC = YES; diff --git a/scripts/build_libffi.js b/scripts/build_libffi.js index 8958424d8..a0993b17b 100755 --- a/scripts/build_libffi.js +++ b/scripts/build_libffi.js @@ -11,21 +11,21 @@ const buildTargets = [ sdk: "iphoneos", arch: "arm64", host: "aarch64-apple-darwin13", - minVersionFlag: "-miphoneos-version-min=13.0", + minVersionFlag: "-miphoneos-version-min=15.0", }, { dir: "build_iphonesimulator-x86_64", sdk: "iphonesimulator", arch: "x86_64", host: "x86_64-apple-darwin13", - minVersionFlag: "-mios-simulator-version-min=13.0", + minVersionFlag: "-mios-simulator-version-min=15.0", }, { dir: "build_iphonesimulator-arm64", sdk: "iphonesimulator", arch: "arm64", host: "aarch64-apple-darwin13", - minVersionFlag: "-mios-simulator-version-min=13.0", + minVersionFlag: "-mios-simulator-version-min=15.0", }, { dir: "build_macosx-x86_64", diff --git a/scripts/run-tests-ios.js b/scripts/run-tests-ios.js index 2a66e5ca8..a889f10d4 100644 --- a/scripts/run-tests-ios.js +++ b/scripts/run-tests-ios.js @@ -485,7 +485,7 @@ function buildTKLiveSyncSimulatorXCFramework() { runAndRequireSuccess("xcrun", [ "--sdk", "iphonesimulator", "clang", - "-target", "arm64-apple-ios13.0-simulator", + "-target", "arm64-apple-ios15.0-simulator", "-dynamiclib", sourcePath, "-install_name", "@rpath/TKLiveSync.framework/TKLiveSync", @@ -495,7 +495,7 @@ function buildTKLiveSyncSimulatorXCFramework() { runAndRequireSuccess("xcrun", [ "--sdk", "iphonesimulator", "clang", - "-target", "x86_64-apple-ios13.0-simulator", + "-target", "x86_64-apple-ios15.0-simulator", "-dynamiclib", sourcePath, "-install_name", "@rpath/TKLiveSync.framework/TKLiveSync", diff --git a/scripts/test_react_native_ffi_compat.sh b/scripts/test_react_native_ffi_compat.sh index 9182a4525..5f11c79a3 100755 --- a/scripts/test_react_native_ffi_compat.sh +++ b/scripts/test_react_native_ffi_compat.sh @@ -118,7 +118,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/NativeScript/napi-ios" s.license = "Apache-2.0" s.author = "NativeScript Team" - s.platforms = { :ios => "13.0" } + s.platforms = { :ios => "15.0" } s.source = { :path => "." } s.requires_arc = true s.prefix_header_file = "fixtures/TestFixtures-Prefix.h"