Post

Replies

Boosts

Views

Activity

Reply to NSInternalInconsistencyException assertion from [NSRemoteView containingWindowWillOrderOnScreen:] on macOS 27 (26A5378j)
I ran into the same issue on all three beta builds: 26A5388g 26A5378n 26A5378j I added a guard as a workaround. My app has been live for about two weeks, and since releasing the new version, the crashes have stopped. Hopefully Apple can fix this issue soon. Guard code: @implementation TBRemoteViewCrashGuard + (void)install { if (![self shouldInstall]) { return; } static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ [self swizzleContainingWindowWillOrderOnScreen]; }); } #pragma mark - Private /// 仅在 macOS 27 上生效(Beta 系统存在此 Bug) + (BOOL)shouldInstall { NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; // macOS 27.x — 待 Apple 正式版确认修复后可收窄条件或移除 return version.majorVersion == 27; } + (void)swizzleContainingWindowWillOrderOnScreen { Class cls = NSClassFromString(@"NSRemoteView"); if (!cls) { return; } SEL originalSel = NSSelectorFromString(@"containingWindowWillOrderOnScreen:"); Method originalMethod = class_getInstanceMethod(cls, originalSel); if (!originalMethod) { return; } // 用 block 包裹原实现,加 @try/@catch 防止断言崩溃 IMP originalIMP = method_getImplementation(originalMethod); IMP guardedIMP = imp_implementationWithBlock(^(id self, NSWindow *window) { @try { ((void(*)(id, SEL, NSWindow *))originalIMP)(self, originalSel, window); } @catch (NSException *exception) { // 仅吞掉 NSRemoteView 的断言异常,其它异常继续抛出 if ([exception.name isEqualToString:NSInternalInconsistencyException] && [exception.reason containsString:@"NSRemoteView"]) { TBLogInfo(@"[RemoteViewCrashGuard] Suppressed NSRemoteView assertion: %@", exception.reason); } else { @throw; } } }); method_setImplementation(originalMethod, guardedIMP); TBLogInfo(@"[RemoteViewCrashGuard] Installed for macOS %ld.x", (long)[[NSProcessInfo processInfo] operatingSystemVersion].majorVersion); } @end The crash stack Date/Time: 2026-07-30 21:42:43.527 +0800 OS Version: macOS 27.0 (26A5388g) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000 at 0x0000000000000000 Triggered by Thread: 0 Application Specific Information: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'assertion failed: '<NSRemoteView: 0x7a4d228900 com.apple.SafariPlatformSupport.Helper SPCompletionListServiceViewController> notified of <NSStatusBarWindow: 0x7a4d3e3200> but expected (null)' in -[NSRemoteView containingWindowWillOrderOnScreen:] on line 4221 of file /AppleInternal/Library/BuildRoots/4~CTiUugCoYHT2c7uJUlZ579eHNtPUHFSW5CSk0cY/Library/Caches/com.apple.xbs/TemporaryDirectory.PDwelI/Sources/ViewBridge/NSRemoteView.m' Thread 0 Crashed: 0 CoreFoundation 0x00000001892ca43c __exceptionPreprocess + 164 1 libobjc.A.dylib 0x0000000188d285e4 objc_exception_throw + 88 2 CoreFoundation 0x00000001892eef4c -[NSException raise] + 16 3 ViewBridge 0x0000000193ed13f0 -[NSRemoteView containingWindowWillOrderOnScreen:] + 216 4 CoreFoundation 0x000000018924efc4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 5 CoreFoundation 0x00000001892dde84 ___CFXRegistrationPost_block_invoke + 92 6 CoreFoundation 0x00000001892dddc8 _CFXRegistrationPost + 440 7 CoreFoundation 0x000000018921b304 _CFXNotificationPost + 688 8 Foundation 0x000000018a900384 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 9 AppKit 0x000000018d8f3800 -[NSWindow _doWindowWillBeVisibleAsSheet:] + 28 10 AppKit 0x000000018e14e12c -[NSWindow _reallyDoOrderWindowAboveOrBelow:] + 1104 11 AppKit 0x000000018e14ecf4 -[NSWindow _reallyDoOrderWindow:] + 64 12 AppKit 0x000000018e14ef78 -[NSWindow _doOrderWindow:] + 300 13 AppKit 0x000000018df7759c orderWindowFrontInAppKitOnly + 52 14 AppKit 0x000000018de3aea0 -[NSSceneStatusItem _wakeStatusItem] + 188 15 AppKit 0x000000018de3cc28 -[NSSceneStatusItem _connectVariantViewScene:] + 440 16 AppKit 0x000000018df6bb10 -[NSStatusBar(NSInternal) _connectVariantViewScene:] + 160 17 AppKit 0x000000018e57e55c -[NSStatusItemVariantSceneDelegate scene:willConnectToSession:options:] + 60 ......
Topic: UI Frameworks SubTopic: AppKit
1d
Reply to NSInternalInconsistencyException assertion from [NSRemoteView containingWindowWillOrderOnScreen:] on macOS 27 (26A5378j)
I ran into the same issue on all three beta builds: 26A5388g 26A5378n 26A5378j I added a guard as a workaround. My app has been live for about two weeks, and since releasing the new version, the crashes have stopped. Hopefully Apple can fix this issue soon. Guard code: @implementation TBRemoteViewCrashGuard + (void)install { if (![self shouldInstall]) { return; } static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ [self swizzleContainingWindowWillOrderOnScreen]; }); } #pragma mark - Private /// 仅在 macOS 27 上生效(Beta 系统存在此 Bug) + (BOOL)shouldInstall { NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion]; // macOS 27.x — 待 Apple 正式版确认修复后可收窄条件或移除 return version.majorVersion == 27; } + (void)swizzleContainingWindowWillOrderOnScreen { Class cls = NSClassFromString(@"NSRemoteView"); if (!cls) { return; } SEL originalSel = NSSelectorFromString(@"containingWindowWillOrderOnScreen:"); Method originalMethod = class_getInstanceMethod(cls, originalSel); if (!originalMethod) { return; } // 用 block 包裹原实现,加 @try/@catch 防止断言崩溃 IMP originalIMP = method_getImplementation(originalMethod); IMP guardedIMP = imp_implementationWithBlock(^(id self, NSWindow *window) { @try { ((void(*)(id, SEL, NSWindow *))originalIMP)(self, originalSel, window); } @catch (NSException *exception) { // 仅吞掉 NSRemoteView 的断言异常,其它异常继续抛出 if ([exception.name isEqualToString:NSInternalInconsistencyException] && [exception.reason containsString:@"NSRemoteView"]) { TBLogInfo(@"[RemoteViewCrashGuard] Suppressed NSRemoteView assertion: %@", exception.reason); } else { @throw; } } }); method_setImplementation(originalMethod, guardedIMP); TBLogInfo(@"[RemoteViewCrashGuard] Installed for macOS %ld.x", (long)[[NSProcessInfo processInfo] operatingSystemVersion].majorVersion); } @end The crash stack Date/Time: 2026-07-30 21:42:43.527 +0800 OS Version: macOS 27.0 (26A5388g) Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000 at 0x0000000000000000 Triggered by Thread: 0 Application Specific Information: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'assertion failed: '<NSRemoteView: 0x7a4d228900 com.apple.SafariPlatformSupport.Helper SPCompletionListServiceViewController> notified of <NSStatusBarWindow: 0x7a4d3e3200> but expected (null)' in -[NSRemoteView containingWindowWillOrderOnScreen:] on line 4221 of file /AppleInternal/Library/BuildRoots/4~CTiUugCoYHT2c7uJUlZ579eHNtPUHFSW5CSk0cY/Library/Caches/com.apple.xbs/TemporaryDirectory.PDwelI/Sources/ViewBridge/NSRemoteView.m' Thread 0 Crashed: 0 CoreFoundation 0x00000001892ca43c __exceptionPreprocess + 164 1 libobjc.A.dylib 0x0000000188d285e4 objc_exception_throw + 88 2 CoreFoundation 0x00000001892eef4c -[NSException raise] + 16 3 ViewBridge 0x0000000193ed13f0 -[NSRemoteView containingWindowWillOrderOnScreen:] + 216 4 CoreFoundation 0x000000018924efc4 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 5 CoreFoundation 0x00000001892dde84 ___CFXRegistrationPost_block_invoke + 92 6 CoreFoundation 0x00000001892dddc8 _CFXRegistrationPost + 440 7 CoreFoundation 0x000000018921b304 _CFXNotificationPost + 688 8 Foundation 0x000000018a900384 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 9 AppKit 0x000000018d8f3800 -[NSWindow _doWindowWillBeVisibleAsSheet:] + 28 10 AppKit 0x000000018e14e12c -[NSWindow _reallyDoOrderWindowAboveOrBelow:] + 1104 11 AppKit 0x000000018e14ecf4 -[NSWindow _reallyDoOrderWindow:] + 64 12 AppKit 0x000000018e14ef78 -[NSWindow _doOrderWindow:] + 300 13 AppKit 0x000000018df7759c orderWindowFrontInAppKitOnly + 52 14 AppKit 0x000000018de3aea0 -[NSSceneStatusItem _wakeStatusItem] + 188 15 AppKit 0x000000018de3cc28 -[NSSceneStatusItem _connectVariantViewScene:] + 440 16 AppKit 0x000000018df6bb10 -[NSStatusBar(NSInternal) _connectVariantViewScene:] + 160 17 AppKit 0x000000018e57e55c -[NSStatusItemVariantSceneDelegate scene:willConnectToSession:options:] + 60 ......
Topic: UI Frameworks SubTopic: AppKit
Replies
Boosts
Views
Activity
1d