Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 28 additions & 78 deletions NativeScript/runtime/NativeScriptException.mm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
return *map;
}

static NSArray<UIWindow*>* AllSceneWindows() {
NSMutableArray<UIWindow*>* 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 {
Expand Down Expand Up @@ -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) {
Comment thread
NathanWalker marked this conversation as resolved.
Resolved
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);
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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<UIWindow*>* windows = nil;
#if TARGET_OS_VISION
if (@available(iOS 13.0, *)) {
NSMutableArray<UIWindow*>* 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<UIWindow*>* windows = AllSceneWindows();
BOOL windowInHierarchy = [windows containsObject:errorWindow];
// Log(@"Error window in app windows: %@", windowInHierarchy ? @"YES" : @"NO");

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-spm-manifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-spm-probe.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
],
Expand Down
4 changes: 2 additions & 2 deletions spm-templates/local-spm-ios/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions spm-templates/local-spm-visionos/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import PackageDescription
let package = Package(
name: "NativeScriptSDK",
platforms: [
.iOS(.v13),
.macCatalyst(.v13),
.iOS(.v15),
.macCatalyst(.v15),
.visionOS(.v1),
],
products: [
Expand Down
40 changes: 20 additions & 20 deletions v8ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading