aurora-imui
aurora-imui copied to clipboard
iphone刘海屏适配
My environment: swift 5 iphoneX 及以上刘海屏 12.2
1.文字键盘弹出会有34的空白间隙
2.点击输入框偶发崩溃 *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0xc0db0d199596e21e> {length = 2, path = 0 - 0}' *** First throw call stack: ( 0 CoreFoundation 0x00000001046386fb __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010689eac5 objc_exception_throw + 48 2 CoreFoundation 0x0000000104638482 +[NSException raise:format:arguments:] + 98 3 Foundation 0x0000000105645927 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194 4 UIKitCore 0x00000001100bdef4 __45-[UICollectionViewData validateLayoutInRect:]_block_invoke + 1338 5 UIKitCore 0x00000001100bd485 -[UICollectionViewData validateLayoutInRect:] + 2496 6 UIKitCore 0x000000011008bb4e -[UICollectionView layoutSubviews] + 261 7 UIKitCore 0x0000000110cd79c1 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1417 8 QuartzCore 0x000000010651feae -[CALayer layoutSublayers] + 173 9 QuartzCore 0x0000000106524b88 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 396 10 UIKitCore 0x0000000110cc2985 -[UIView(Hierarchy) layoutBelowIfNeeded] + 646 11 AuroraIMUI 0x0000000103ba8443 $s10AuroraIMUI19IMUICustomInputViewC20keyboardFrameChangedyy10Foundation12NotificationVF + 2771 12 AuroraIMUI 0x0000000103ba8b68 $s10AuroraIMUI19IMUICustomInputViewC20keyboardFrameChangedyy10Foundation12NotificationVFTo + 136 13 CoreFoundation 0x000000010457a5ec CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 12 14 CoreFoundation 0x0000000104579a6f _CFXRegistrationPost + 447 15 CoreFoundation 0x00000001045797b3 ___CFXNotificationPost_block_invoke + 227 16 CoreFoundation 0x000000010465d5e2 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1858 17 CoreFoundation 0x0000000104579101 _CFXNotificationPost + 977 18 Foundation 0x00000001056a3eaf -[NSNotificationCenter postNotificationName:object:userInfo:] + 66 19 UIKitCore 0x0000000110600611 -[UIInputWindowController postStartNotifications:withInfo:] + 861 20 UIKitCore 0x0000000110603066 __77-[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:]_block_invoke.926 + 515 21 UIKitCore 0x0000000110ccb3e5 +[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 569 22 UIKitCore 0x0000000110ccb838 +[UIView(UIViewAnimationWithBlocks) _animateWithDuration:delay:options:animations:start:completion:] + 116 23 UIKitCore 0x0000000110602b08 -[UIInputWindowController moveFromPlacement:toPlacement:starting:completion:] + 1662 24 UIKitCore 0x000000011060ac01 -[UIInputWindowController setPlacement:] + 73 25 UIKitCore 0x0000000110602152 -[UIInputWindowController performOperations:withAnimationStyle:] + 47 26 UIKitCore 0x000000011067cffe __80-[UIPeripheralHost(UIKitInternal) performMultipleOperations:withAnimationStyle:]_block_invoke + 140 27 UIKitCore 0x00000001106997e0 -[_UIRemoteKeyboards performOnControllers:] + 270 28 UIKitCore 0x000000011067ceaf -[UIPeripheralHost(UIKitInternal) performMultipleOperations:withAnimationStyle:] + 141 29 UIKitCore 0x000000011067d44f -[UIPeripheralHost(UIKitInternal) maximizeWithAnimation:] + 151 30 UIKitCore 0x00000001106488e4 -[UIKeyboardImpl showKeyboard] + 152 31 UIKitCore 0x000000011064b2d6 -[UIKeyboardImpl showKeyboardIfNeeded] + 67 32 UIKitCore 0x0000000110abf908 -[UITextSelectionInteraction oneFingerTap:] + 4032 33 UIKitCore 0x00000001103f314d -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] + 57 34 UIKitCore 0x00000001103fbc69 _UIGestureRecognizerSendTargetActions + 109 35 UIKitCore 0x00000001103f95ba _UIGestureRecognizerSendActions + 311 36 UIKitCore 0x00000001103f8897 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 966 37 UIKitCore 0x00000001103eac4e _UIGestureEnvironmentUpdate + 2820 38 UIKitCore 0x00000001103ea108 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 478 39 UIKitCore 0x00000001103e9e96 -[UIGestureEnvironment _updateForEvent:window:] + 200 40 UIKitCore 0x00000001108455bc -[UIWindow sendEvent:] + 4057 41 UIKitCore 0x0000000110823d16 -[UIApplication sendEvent:] + 356 42 UIKitCore 0x00000001108f4293 __dispatchPreprocessedEventFromEventQueue + 3232 43 UIKitCore 0x00000001108f6bb9 __handleEventQueueInternal + 5911 44 CoreFoundation 0x000000010459fbe1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 45 CoreFoundation 0x000000010459f463 __CFRunLoopDoSources0 + 243 46 CoreFoundation 0x0000000104599b1f __CFRunLoopRun + 1231 47 CoreFoundation 0x0000000104599302 CFRunLoopRunSpecific + 626 48 GraphicsServices 0x0000000107d122fe GSEventRunModal + 65 49 UIKitCore 0x0000000110809ba2 UIApplicationMain + 140 50 yuliao 0x00000001031491ab main + 75 51 libdyld.dylib 0x000000010a959541 start + 1 52 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException
后面反复测试发现
反复进行 输入框 ->图片->空白区域收回->图片->输入框 必定崩溃
奔溃断点 self.superview?.layoutIfNeeded()