Post

Replies

Boosts

Views

Activity

App crashes with error "Fatal Exception: NSInvalidArgumentException -[<NSTextContentStorage: 0x281dc68a0> locationFromLocation:withOffset:] received invalid location (null)"
From IOS 16 onwards my app which uses UITextView in iOS for editing, started crashing for a number of users with error. App crashes with error "Fatal Exception: NSInvalidArgumentException -[<NSTextContentStorage: 0x281dc68a0> locationFromLocation:withOffset:] received invalid location (null)" After researching we found that this could be an issue with the new textkit engine of UITextView. And to restore the previous behavior and avoid the crash, we explicitly set the UITextView to use TextKit 1 and re-released the app with Xcode 14.0. But unfortunately, even after this change, this crash is not gone and users are still facing this issue. Adding a link that suggests a response from the Apple developers team to change textkit engine from textkit 2 to textkit 1 for this issue. https://lapcatsoftware.com/articles/textview5.html I'm also adding complete stack trace of this crash Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x9e88 __exceptionPreprocess 1 libobjc.A.dylib 0x178d8 objc_exception_throw 2 CoreFoundation 0xf9c58 __CFDictionaryCreateGeneric 3 UIFoundation 0x220e0 -[NSTextContentStorage locationFromLocation:withOffset:] 4 UIFoundation 0x9f104 -[NSTextLineFragment textLineFragmentRange] 5 UIFoundation 0x86e70 __95-[NSTextLayoutManager _copyTextLineFragmentRangeForPoint:inContainerAtLocation:pointPlacement:]_block_invoke 6 CoreFoundation 0xa3a0 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK 7 CoreFoundation 0x910e0 -[__NSArrayI enumerateObjectsWithOptions:usingBlock:] 8 UIFoundation 0x86cfc -[NSTextLayoutManager _copyTextLineFragmentRangeForPoint:inContainerAtLocation:pointPlacement:] 9 UIFoundation 0x86eb4 -[NSTextLayoutManager lineFragmentRangeForPoint:inContainerAtLocation:] 10 UIFoundation 0x7e6ec -[NSTextSelectionNavigation _lineFragmentInfoForPoint:inContainerAtLocation:bounds:layoutOrientation:beforeLineFragment:afterLineFragment:lineFragmentRange:] 11 UIFoundation 0x815d8 -[NSTextSelectionNavigation textSelectionsInteractingAtPoint:inContainerAtLocation:anchors:modifiers:selecting:bounds:] 12 UIKitCore 0x98f5d8 -[_UITextKit2LayoutController cursorPositionAtPoint:inContainer:] 13 UIKitCore 0xf33d88 -[UITextInputController _characterPositionForPoint:] 14 UIKitCore 0xf4a2cc -[UITextView closestPositionToPoint:] 15 UIKitCore 0xedef5c -[UITextSelectionInteraction tappedToPositionCursorWithGesture:atPoint:granularity:completionHandler:] 16 UIKitCore 0xedecc8 -[UITextSelectionInteraction _checkForRepeatedTap:gestureLocationOut:] 17 UIKitCore 0xedf524 -[UITextSelectionInteraction _handleMultiTapGesture:] 18 UIKitCore 0x24ed54 -[UIApplication sendAction:to:from:forEvent:] 19 UIKitCore 0x9448fc -[UITextMultiTapRecognizer onStateUpdate:] 20 UIKitCore 0xbe874 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] 21 UIKitCore 0x42c9f0 _UIGestureRecognizerSendTargetActions 22 UIKitCore 0x1a60a4 _UIGestureRecognizerSendActions 23 UIKitCore 0x86a14 -[UIGestureRecognizer _updateGestureForActiveEvents] 24 UIKitCore 0x1328d8 _UIGestureEnvironmentUpdate 25 UIKitCore 0x9b7e14 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] 26 UIKitCore 0xf731c -[UIGestureEnvironment _updateForEvent:window:] 27 UIKitCore 0xfbc74 -[UIWindow sendEvent:] 28 UIKitCore 0xfaf44 -[UIApplication sendEvent:] 29 Aspen 0x6963c0 TimerApplication.sendEvent(_:) () 30 Aspen 0x696834 @objc TimerApplication.sendEvent(_:) () 31 UIKitCore 0xfa600 __dispatchPreprocessedEventFromEventQueue Please let us know how can we fix this issue, app was working fine sine IOS 11.0 but suddenly it has started crashing. Currently users are also facing this issue in updated IOS version IOS 16.1.1 Device - iPhone 12 , iPhone 12 Pro, iPhone 13
16
6
5.2k
Nov ’22
From IOS 16 onwards my app which uses UITextView in iOS for editing, started crashing for a number of users with error
App crashes with error "Fatal Exception: NSInvalidArgumentException -[<NSTextContentStorage: 0x281dc68a0> locationFromLocation:withOffset:] received invalid location (null)" **After researching we found that this could be an issue with the new textkit engine of UITextView. And to restore the previous behavior and avoid the crash, we explicitly set the UITextView to use TextKit 1. But unfortunately, even after this change, this crash is not gone and users are still facing this issue. I'm also adding complete stack trace of this crash Fatal Exception: NSInvalidArgumentException 0 CoreFoundation        0x9e88 __exceptionPreprocess 1 libobjc.A.dylib        0x178d8 objc_exception_throw 2 CoreFoundation        0xf9c58 __CFDictionaryCreateGeneric 3 UIFoundation         0x220e0 -[NSTextContentStorage locationFromLocation:withOffset:] 4 UIFoundation         0x9f104 -[NSTextLineFragment textLineFragmentRange] 5 UIFoundation         0x86e70 __95-[NSTextLayoutManager _copyTextLineFragmentRangeForPoint:inContainerAtLocation:pointPlacement:]_block_invoke 6 CoreFoundation        0xa3a0 NSARRAY_IS_CALLING_OUT_TO_A_BLOCK 7 CoreFoundation        0x910e0 -[__NSArrayI  enumerateObjectsWithOptions:usingBlock:] 8 UIFoundation         0x86cfc -[NSTextLayoutManager _copyTextLineFragmentRangeForPoint:inContainerAtLocation:pointPlacement:] 9 UIFoundation         0x86eb4 -[NSTextLayoutManager lineFragmentRangeForPoint:inContainerAtLocation:] 10 UIFoundation         0x7e6ec -[NSTextSelectionNavigation _lineFragmentInfoForPoint:inContainerAtLocation:bounds:layoutOrientation:beforeLineFragment:afterLineFragment:lineFragmentRange:] 11 UIFoundation         0x815d8 -[NSTextSelectionNavigation textSelectionsInteractingAtPoint:inContainerAtLocation:anchors:modifiers:selecting:bounds:] 12 UIKitCore           0x98f5d8 -[_UITextKit2LayoutController cursorPositionAtPoint:inContainer:] 13 UIKitCore           0xf33d88 -[UITextInputController _characterPositionForPoint:] 14 UIKitCore           0xf4a2cc -[UITextView closestPositionToPoint:] 15 UIKitCore           0xedef5c -[UITextSelectionInteraction tappedToPositionCursorWithGesture:atPoint:granularity:completionHandler:] 16 UIKitCore           0xedecc8 -[UITextSelectionInteraction _checkForRepeatedTap:gestureLocationOut:] 17 UIKitCore           0xedf524 -[UITextSelectionInteraction _handleMultiTapGesture:] 18 UIKitCore           0x24ed54 -[UIApplication sendAction:to:from:forEvent:] 19 UIKitCore           0x9448fc -[UITextMultiTapRecognizer onStateUpdate:] 20 UIKitCore           0xbe874 -[UIGestureRecognizerTarget _sendActionWithGestureRecognizer:] 21 UIKitCore           0x42c9f0 _UIGestureRecognizerSendTargetActions 22 UIKitCore           0x1a60a4 _UIGestureRecognizerSendActions 23 UIKitCore           0x86a14 -[UIGestureRecognizer _updateGestureForActiveEvents] 24 UIKitCore           0x1328d8 _UIGestureEnvironmentUpdate 25 UIKitCore           0x9b7e14 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] 26 UIKitCore           0xf731c -[UIGestureEnvironment _updateForEvent:window:] 27 UIKitCore           0xfbc74 -[UIWindow sendEvent:] 28 UIKitCore           0xfaf44 -[UIApplication sendEvent:] 29 Aspen             0x6963c0 TimerApplication.sendEvent(_:) () 30 Aspen             0x696834 @objc TimerApplication.sendEvent(_:) () 31 UIKitCore           0xfa600 __dispatchPreprocessedEventFromEventQueue Also, the app was re-released in Appstore with Xcode 14.0. Any help would be appreciated.
1
0
1.2k
Nov ’22