diff --git a/NativeScript/runtime/NativeScriptException.mm b/NativeScript/runtime/NativeScriptException.mm index ee29e0ac1..7d251197c 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 { @@ -1171,42 +1181,25 @@ static void RenderErrorModalUI(v8::Isolate* isolate, const std::string& title, UpdateDisplayedStackText(stackForModal); - 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; - } - } + // UIKit reads and the isErrorDisplayShowing check-and-set must happen on the main thread. + auto showSynchronously = ^{ + if (isErrorDisplayShowing) { + return; } - } -#else - hasAnyWindows = app.windows.count > 0; -#endif - 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; - } - 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); @@ -1234,21 +1227,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 +1285,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 +1562,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",