You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

iOS 26系列版本中_UIRemoteKeyboardPlaceholderView约束激活失败导致的崩溃问题求助

iOS 26系列版本中_UIRemoteKeyboardPlaceholderView约束激活失败导致的崩溃问题求助

各位好,最近我在自己的SwiftUI应用里碰到了一个棘手的崩溃问题,想请教下有没有朋友遇到过或者知道排查方向:

  • 崩溃仅出现在iOS 26全版本(包括26.2 beta),iOS 26之前的版本完全正常
  • 我的应用里完全没有手动编写任何和键盘绑定的逻辑,所有视图都设置了忽略键盘(没有做键盘避让处理)
  • 崩溃触发时的核心错误提示如下:

NSGenericException: Unable to activate constraint with anchors <NSLayoutYAxisAnchor:0x1183f7a40 "UIView:0x11831abc0.top"> and <NSLayoutYAxisAnchor:0x1183c0800 "_UIRemoteKeyboardPlaceholderView:0x12ac62e00.bottom"> because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal.

完整崩溃堆栈信息:

0 CoreFoundation +0xc98c4 ___exceptionPreprocess
1 libobjc.A.dylib +0x317c0 _objc_exception_throw
2 CoreAutoLayout +0x22548 -[NSLayoutConstraint _setActive:mutuallyExclusiveConstraints:]
3 CoreAutoLayout +0x30fe8 ___55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke
4 CoreAutoLayout +0x13d60 -[NSISEngine withBehaviors:performModifications:]
5 CoreAutoLayout +0x22698 +[NSLayoutConstraint _addOrRemoveConstraints:activate:]
6 UIKitCore +0x38d43c -[UIInputWindowControllerHostingItem updateViewConstraints]
7 UIKitCore +0x392610 -[UIInputWindowController updateSupportsDockViewController]
8 UIKitCore +0x210cd4 -[UIInputSetHostView _updateSafeAreaInsets]
9 UIKitCore +0x18fcff0 -[UIView(Geometry) _applyISEngineLayoutValuesToBoundsOnly:]
10 UIKitCore +0x18fd0d0 -[UIView(Geometry) _resizeWithOldSuperviewSize:]
11 CoreFoundation +0x1514c ___NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
12 CoreFoundation +0x186b60 -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:]
13 UIKitCore +0x18fc6dc -[UIView(Geometry) resizeSubviewsWithOldSize:]
14 UIKitCore +0x4fc8c -[UIView(AdditionalLayoutSupport) _is_layout]
15 UIKitCore +0x43468 -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine]
16 UIKitCore +0x2750c -[UIView(Hierarchy) layoutSubviews]
17 UIKitCore +0x27074 0x18899a074 (0x188999d3c + 824)
18 UIKitCore +0x27b34 0x18899ab34 (0x18899ab14 + 32)
19 UIKitCore +0x190df64 -[UIView(CALayerDelegate) layoutSublayersOfLayer:]
20 QuartzCore +0xac9a4 CA::Layer::perform_update_(CA::Layer*, CALayer*, unsigned int, CA::Transaction*)
21 QuartzCore +0x8f2f8 CA::Layer::update_if_needed(CA::Transaction*, unsigned int, unsigned int)
22 UIKitCore +0x57b0 -[UIView(Hierarchy) layoutBelowIfNeeded]
23 UIKitCore +0x3918d8 -[UIInputSetHostView layoutIfNeeded]
24 UIKitCore +0x114553c ___64-[UIInputWindowControllerHostingItem updateTransition:withInfo:]_block_invoke
25 UIKitCore +0x11454cc -[UIInputWindowControllerHostingItem updateTransition:withInfo:]
26 UIKitCore +0x11c4a64 ___65-[_UIRemoteKeyboards _performOnDistributedControllersExceptSelf:]_block_invoke
27 UIKitCore +0x11c491c -[_UIRemoteKeyboards performOnControllers:]
28 UIKitCore +0x11c4a04 -[_UIRemoteKeyboards _performOnDistributedControllersExceptSelf:]
29 UIKitCore +0x11a0354 -[UIFlickingAssistantViewSupport updateTransition:animated:]
30 UIKitCore +0x119eb8c -[UIFlickingAssistantViewSupport _updatedController]
31 UIKitCore +0x1199268 -[UIKeyboardMotionSupport setMasterController:]
32 UIKitCore +0x1146e2c -[UIInputWindowControllerHostingItem configureFlickingAssistantViewController:]
33 CoreFoundation +0x144d60 -[NSArray makeObjectsPerformSelector:]
34 UIKitCore +0x1139784 -[UIInputWindowController changeToInputViewSet:]
35 UIKitCore +0x113ad80 ___43-[UIInputWindowController setInputViewSet:]_block_invoke
36 UIKitCore +0x19047f8 +[UIView(Animation) performWithoutAnimation:]
37 UIKitCore +0x113a8e8 -[UIInputWindowController setInputViewSet:]
38 UIKitCore +0x112fa20 -[UIInputWindowController performOperations:withAnimationStyle:]
39 UIKitCore +0xd81ab0 -[UIKeyboardSceneDelegate setKeyWindowSceneInputViews:animationStyle:]
40 UIKitCore +0xd80ff0 -[UIKeyboardSceneDelegate setInputViews:animationStyle:]
41 UIKitCore +0xd820a8 -[UIKeyboardSceneDelegate setInputViews:animated:]
42 UIKitCore +0xd8210c -[UIKeyboardSceneDelegate setInputViews:]
43 UIKitCore +0xd7f554 ___102-[UIKeyboardSceneDelegate _reloadInputViewsForKeyWindowSceneResponder:force:fromBecomeFirstResponder:]_block_invoke.587
44 UIKitCore +0x1191fe4 ___65-[UIPeripheralHost(UIKitInternal) queueDelayedTask:forKey:delay:]_block_invoke
45 libdispatch.dylib +0x1b7e8 __dispatch_client_callout
46 libdispatch.dylib +0x6660 __dispatch_continuation_pop
47 libdispatch.dylib +0x19524 __dispatch_source_latch_and_call
48 libdispatch.dylib +0x181f8 __dispatch_source_invoke
49 libdispatch.dylib +0x38a44 __dispatch_main_queue_drain.cold.5
50 libdispatch.dylib +0x10ec4 __dispatch_main_queue_drain
51 libdispatch.dylib +0x10e00 __dispatch_main_queue_callback_4CF
52 CoreFoundation +0x6b51c ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_

从错误信息来看,是系统内部尝试给普通UIView和_UIRemoteKeyboardPlaceholderView(键盘占位视图)添加约束,但两者不在同一个视图层级导致崩溃。可我完全没碰过键盘相关代码,实在搞不懂为什么会触发这个问题。

有没有朋友遇到过类似情况?或者有什么排查方向可以推荐?比如是不是SwiftUI在iOS 26里的某个隐式行为发生了变化?感激不尽!

火山引擎 最新活动