From 60f5a03c0517780ef37402041f7fa70d79ae254c Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Thu, 19 Nov 2026 16:32:19 -0800 Subject: [PATCH 1/2] fix: raise the iOS deployment target to 15.0 for Xcode 27.2 Xcode 27.2 only accepts iOS deployment targets from 15.0, so apps created from the project template (and the runtime itself) failed to build with IPHONEOS_DEPLOYMENT_TARGET = 13.0. - project template and v8ios.xcodeproj targets: 13.0 -> 15.0 (TestRunnerTests' Catalyst macOS target 10.15 -> 12.0 to match) - SwiftPM manifests/templates: .iOS/.macCatalyst .v13 -> .v15 - NativeScriptException.mm: UIApplication.windows is deprecated as of iOS 15 and the runtime builds with -Werror, so collect windows from the connected window scenes on every platform, as visionOS already did Fixes #577 --- NativeScript/runtime/NativeScriptException.mm | 76 ++++--------------- README.md | 2 +- .../project.pbxproj | 4 +- scripts/generate-spm-manifest.mjs | 4 +- scripts/generate-spm-probe.mjs | 2 +- spm-templates/local-spm-ios/Package.swift | 4 +- .../local-spm-visionos/Package.swift | 4 +- v8ios.xcodeproj/project.pbxproj | 40 +++++----- 8 files changed, 44 insertions(+), 92 deletions(-) diff --git a/NativeScript/runtime/NativeScriptException.mm b/NativeScript/runtime/NativeScriptException.mm index ee29e0ac1..57ef70939 100644 --- a/NativeScript/runtime/NativeScriptException.mm +++ b/NativeScript/runtime/NativeScriptException.mm @@ -60,6 +60,16 @@ return *map; } +static NSArray* AllSceneWindows() { + NSMutableArray* windows = [NSMutableArray array]; + for (UIScene* scene in [UIApplication sharedApplication].connectedScenes) { + if ([scene isKindOfClass:[UIWindowScene class]]) { + [windows addObjectsFromArray:((UIWindowScene*)scene).windows]; + } + } + return windows; +} + } // namespace namespace tns { @@ -1174,22 +1184,7 @@ static void RenderErrorModalUI(v8::Isolate* isolate, const std::string& title, bool alreadyShowing = isErrorDisplayShowing; UIApplication* app = [UIApplication sharedApplication]; - BOOL hasAnyWindows = NO; -#if TARGET_OS_VISION - if (@available(iOS 13.0, *)) { - for (UIScene* scene in app.connectedScenes) { - if ([scene isKindOfClass:[UIWindowScene class]]) { - UIWindowScene* ws = (UIWindowScene*)scene; - if (ws.windows.count > 0) { - hasAnyWindows = YES; - break; - } - } - } - } -#else - hasAnyWindows = app.windows.count > 0; -#endif + BOOL hasAnyWindows = AllSceneWindows().count > 0; if (!alreadyShowing && !hasAnyWindows && app.connectedScenes.count == 0) { Log(@"Note: JavaScript error during boot."); Log(@"================================"); @@ -1234,21 +1229,7 @@ static void ShowErrorModalSynchronously(const std::string& title, const std::str UIApplication* sharedApp = [UIApplication sharedApplication]; // If no windows exist, create a foundational window to establish the hierarchy - BOOL appHasWindows = NO; -#if TARGET_OS_VISION - if (@available(iOS 13.0, *)) { - for (UIScene* scene in sharedApp.connectedScenes) { - if ([scene isKindOfClass:[UIWindowScene class]]) { - if (((UIWindowScene*)scene).windows.count > 0) { - appHasWindows = YES; - break; - } - } - } - } -#else - appHasWindows = sharedApp.windows.count > 0; -#endif + BOOL appHasWindows = AllSceneWindows().count > 0; if (!appHasWindows) { // Log(@"🚀 Bootstrap: No app windows exist - creating foundational window hierarchy"); @@ -1306,21 +1287,7 @@ static void ShowErrorModalSynchronously(const std::string& title, const std::str CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.01, false); // Detailed window hierarchy inspection - BOOL appHasWindowsAfterBootstrap = NO; -#if TARGET_OS_VISION - if (@available(iOS 13.0, *)) { - for (UIScene* scene in sharedApp.connectedScenes) { - if ([scene isKindOfClass:[UIWindowScene class]]) { - if (((UIWindowScene*)scene).windows.count > 0) { - appHasWindowsAfterBootstrap = YES; - break; - } - } - } - } -#else - appHasWindowsAfterBootstrap = sharedApp.windows.count > 0; -#endif + BOOL appHasWindowsAfterBootstrap = AllSceneWindows().count > 0; if (!appHasWindowsAfterBootstrap) { // Log(@"🚀 Bootstrap: 🚨 CRITICAL: Foundation window not in app.windows hierarchy!"); // Log(@"🚀 Bootstrap: This indicates a fundamental iOS window system issue"); @@ -1597,22 +1564,7 @@ static void ShowErrorModalSynchronously(const std::string& title, const std::str [errorWindow bringSubviewToFront:errorViewController.view]; // Verify the window is in the window hierarchy - NSArray* windows = nil; -#if TARGET_OS_VISION - if (@available(iOS 13.0, *)) { - NSMutableArray* acc = [NSMutableArray array]; - for (UIScene* scene in [UIApplication sharedApplication].connectedScenes) { - if ([scene isKindOfClass:[UIWindowScene class]]) { - [acc addObjectsFromArray:((UIWindowScene*)scene).windows]; - } - } - windows = [acc copy]; - } else { - windows = @[]; - } -#else - windows = [UIApplication sharedApplication].windows; -#endif + NSArray* windows = AllSceneWindows(); BOOL windowInHierarchy = [windows containsObject:errorWindow]; // Log(@"Error window in app windows: %@", windowInHierarchy ? @"YES" : @"NO"); diff --git a/README.md b/README.md index 58990240d..3451a5a6e 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ Supported architectures: - arm64 iOS deployment target: - - 9.0 + - 15.0 The `--jitless` mode in which V8 is running is explained in the following [document](https://docs.google.com/document/d/1YYU17VqFMBeSJ8whCqXknOGXtXDVDLulchsTkmi0YdI/edit#heading=h.mz26kq2dsu6k) diff --git a/project-template-ios/__PROJECT_NAME__.xcodeproj/project.pbxproj b/project-template-ios/__PROJECT_NAME__.xcodeproj/project.pbxproj index e4a61dba4..36391b5dc 100644 --- a/project-template-ios/__PROJECT_NAME__.xcodeproj/project.pbxproj +++ b/project-template-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/generate-spm-manifest.mjs b/scripts/generate-spm-manifest.mjs index 37973be9b..5c9182c30 100644 --- a/scripts/generate-spm-manifest.mjs +++ b/scripts/generate-spm-manifest.mjs @@ -216,8 +216,8 @@ let releaseBase = "https://github.com/NativeScript/ios/releases/download/v\\(nsV let package = Package( name: "NativeScriptSDK", platforms: [ - .iOS(.v13), - .macCatalyst(.v13),${visionPlatform} + .iOS(.v15), + .macCatalyst(.v15),${visionPlatform} ], products: [ // iOS family (iphoneos + iphonesimulator + Mac Catalyst). Apps built by diff --git a/scripts/generate-spm-probe.mjs b/scripts/generate-spm-probe.mjs index 685f6c536..52c27cb89 100644 --- a/scripts/generate-spm-probe.mjs +++ b/scripts/generate-spm-probe.mjs @@ -89,7 +89,7 @@ import PackageDescription let package = Package( name: "Probe", - platforms: [.iOS(.v13)], + platforms: [.iOS(.v15)], dependencies: [ .package(url: "https://github.com/NativeScript/ios-spm.git", exact: "${values.version}") ], diff --git a/spm-templates/local-spm-ios/Package.swift b/spm-templates/local-spm-ios/Package.swift index 08c3d0a8a..da0d8d23b 100644 --- a/spm-templates/local-spm-ios/Package.swift +++ b/spm-templates/local-spm-ios/Package.swift @@ -15,8 +15,8 @@ import PackageDescription let package = Package( name: "NativeScriptSDK", platforms: [ - .iOS(.v13), - .macCatalyst(.v13), + .iOS(.v15), + .macCatalyst(.v15), ], products: [ // iOS family (iphoneos + iphonesimulator + Mac Catalyst) diff --git a/spm-templates/local-spm-visionos/Package.swift b/spm-templates/local-spm-visionos/Package.swift index 7aa859e85..3e9f7aec7 100644 --- a/spm-templates/local-spm-visionos/Package.swift +++ b/spm-templates/local-spm-visionos/Package.swift @@ -13,8 +13,8 @@ import PackageDescription let package = Package( name: "NativeScriptSDK", platforms: [ - .iOS(.v13), - .macCatalyst(.v13), + .iOS(.v15), + .macCatalyst(.v15), .visionOS(.v1), ], products: [ diff --git a/v8ios.xcodeproj/project.pbxproj b/v8ios.xcodeproj/project.pbxproj index dca5caf46..d1c862f82 100644 --- a/v8ios.xcodeproj/project.pbxproj +++ b/v8ios.xcodeproj/project.pbxproj @@ -2629,7 +2629,7 @@ ); INFOPLIST_FILE = TKLiveSync/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2667,7 +2667,7 @@ GCC_PREPROCESSOR_DEFINITIONS = "HAVE_CONFIG_H=1"; INFOPLIST_FILE = TKLiveSync/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2707,12 +2707,12 @@ "$(PROJECT_DIR)", ); INFOPLIST_FILE = TestRunnerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 12.0; PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TestRunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2740,12 +2740,12 @@ "$(PROJECT_DIR)", ); INFOPLIST_FILE = TestRunnerTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MACOSX_DEPLOYMENT_TARGET = 10.15; + MACOSX_DEPLOYMENT_TARGET = 12.0; PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TestRunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SUPPORTS_MACCATALYST = YES; @@ -2811,7 +2811,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -2868,7 +2868,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; OTHER_CFLAGS = ""; @@ -2896,7 +2896,7 @@ "$(SRCROOT)/NativeScript/embedding/", ); INFOPLIST_FILE = AppWithModules/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2934,7 +2934,7 @@ "$(SRCROOT)/NativeScript/embedding/", ); INFOPLIST_FILE = AppWithModules/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2968,7 +2968,7 @@ "$(SRCROOT)/NativeScript", "$(SRCROOT)/TestFixtures", ); - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -2992,7 +2992,7 @@ "$(SRCROOT)/NativeScript", "$(SRCROOT)/TestFixtures", ); - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; OTHER_LDFLAGS = "-ObjC"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; @@ -3025,7 +3025,7 @@ "$(SRCROOT)/TestFixtures", ); INFOPLIST_FILE = TestRunner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3087,7 +3087,7 @@ "$(SRCROOT)/TestFixtures", ); INFOPLIST_FILE = TestRunner/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3149,7 +3149,7 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = NativeScript/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; "LD_MAP_FILE_PATH[arch=*]" = "$(TARGET_TEMP_DIR)/$(PRODUCT_NAME)-LinkMap-$(CURRENT_VARIANT)-$(CURRENT_ARCH).txt"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -3243,7 +3243,7 @@ HEADER_SEARCH_PATHS = ""; INFOPLIST_FILE = NativeScript/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@loader_path/Frameworks", @@ -3353,7 +3353,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NativeScriptDefaultMetadata/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3389,7 +3389,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = NativeScriptDefaultMetadata/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3439,7 +3439,7 @@ HEADER_SEARCH_PATHS = "$(SRCROOT)/NativeScript/include"; INFOPLIST_FILE = NativeScriptLeakProbe/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3495,7 +3495,7 @@ HEADER_SEARCH_PATHS = "$(SRCROOT)/NativeScript/include"; INFOPLIST_FILE = NativeScriptLeakProbe/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From d96b4cd18ae5b79776b4b8b135e0899e052f0656 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 20 Nov 2026 10:26:08 -0800 Subject: [PATCH 2/2] fix(runtime): decide error modal display on the main thread Read the scene windows, connected scenes, and isErrorDisplayShowing inside the main-thread block in RenderErrorModalUI, so the UIKit reads and the already-showing check-and-set no longer run on the calling thread. --- NativeScript/runtime/NativeScriptException.mm | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/NativeScript/runtime/NativeScriptException.mm b/NativeScript/runtime/NativeScriptException.mm index 57ef70939..7d251197c 100644 --- a/NativeScript/runtime/NativeScriptException.mm +++ b/NativeScript/runtime/NativeScriptException.mm @@ -1181,27 +1181,25 @@ static void RenderErrorModalUI(v8::Isolate* isolate, const std::string& title, UpdateDisplayedStackText(stackForModal); - bool alreadyShowing = isErrorDisplayShowing; - - UIApplication* app = [UIApplication sharedApplication]; - BOOL hasAnyWindows = AllSceneWindows().count > 0; - if (!alreadyShowing && !hasAnyWindows && app.connectedScenes.count == 0) { - Log(@"Note: JavaScript error during boot."); - Log(@"================================"); - Log(@"%s", stackForModal.c_str()); - Log(@"================================"); - Log(@"Please fix the error and save the file to auto reload the app."); - Log(@"================================"); - return; - } + // UIKit reads and the isErrorDisplayShowing check-and-set must happen on the main thread. + auto showSynchronously = ^{ + if (isErrorDisplayShowing) { + return; + } - if (alreadyShowing) { - return; - } + if (AllSceneWindows().count == 0 && + [UIApplication sharedApplication].connectedScenes.count == 0) { + Log(@"Note: JavaScript error during boot."); + Log(@"================================"); + Log(@"%s", stackForModal.c_str()); + Log(@"================================"); + Log(@"Please fix the error and save the file to auto reload the app."); + Log(@"================================"); + return; + } - isErrorDisplayShowing = true; + isErrorDisplayShowing = true; - auto showSynchronously = ^{ @try { // Log(@"[ShowErrorModal] On main thread - showing modal synchronously %s", message.c_str()); ShowErrorModalSynchronously(title, message, stackForModal);