iOS 17 Beta crash: -[NSCountableTextLocation compare:] receiving unmatching type (null)

Unable to find where this is happening...

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCountableTextLocation compare:] receiving unmatching type (null)'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000012083f88a __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x0000000117674894 objc_exception_throw + 48
    2   CoreFoundation                      0x000000012083f768 -[NSException initWithCoder:] + 0
    3   UIFoundation                        0x000000014ee60aa5 -[NSCountableTextLocation compare:] + 200
    4   UIFoundation                        0x000000014ee25919 -[NSTextLayoutManager _invalidateLayoutForTextRange:hard:] + 1573
    5   UIFoundation                        0x000000014ee26102 -[NSTextLayoutManager processLayoutInvalidationForTextRange:synchronizing:] + 32
    6   CoreFoundation                      0x00000001207a01bd __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
    7   CoreFoundation                      0x0000000120721d57 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 285
    8   UIFoundation                        0x000000014ee83e49 __54-[NSTextContentManager synchronizeTextLayoutManagers:]_block_invoke + 78
    9   CoreFoundation                      0x00000001207a01bd __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 7
    10  CoreFoundation                      0x0000000120721d57 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 285
    11  UIFoundation                        0x000000014ee83dc6 -[NSTextContentManager synchronizeTextLayoutManagers:] + 85
    12  UIFoundation                        0x000000014ee85f51 -[NSTextContentStorage synchronizeTextLayoutManagers:] + 61
    13  UIFoundation                        0x000000014ee84780 -[NSTextContentStorage setAttributedString:] + 162
    14  UIFoundation                        0x000000014ee84488 -[NSTextContentStorage dealloc] + 29
    15  libobjc.A.dylib                     0x0000000117672228 _ZN11objc_object17sidetable_releaseEbb + 204
    16  UIKitCore                           0x000000013f3d5297 -[_UITextKit2LayoutController .cxx_destruct] + 94
    17  libobjc.A.dylib                     0x0000000117652766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
    18  libobjc.A.dylib                     0x000000011766adfc objc_destructInstance + 61
    19  libobjc.A.dylib                     0x000000011767176c -[NSObject dealloc] + 19
    20  UIKitCore                           0x000000013f3ceb68 -[_UITextKit2LayoutController dealloc] + 119
    21  libobjc.A.dylib                     0x0000000117672228 _ZN11objc_object17sidetable_releaseEbb + 204
    22  UIKitCore                           0x000000013fee4aea -[UITextField .cxx_destruct] + 343
    23  libobjc.A.dylib                     0x0000000117652766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
    24  libobjc.A.dylib                     0x000000011766adfc objc_destructInstance + 61
    25  libobjc.A.dylib                     0x000000011767176c -[NSObject dealloc] + 19
    26  UIKitCore                           0x000000013fade794 -[UIResponder dealloc] + 145
    27  UIKit                               0x0000000171b2e9ef -[UIResponderAccessibility dealloc] + 55
    28  UIKitCore                           0x00000001401311e4 -[UIView dealloc] + 1330
    29  UIKitCore                           0x000000013fec9441 -[UITextField dealloc] + 272
    30  libobjc.A.dylib                     0x0000000117672228 _ZN11objc_object17sidetable_releaseEbb + 204
    31  CoreFoundation                      0x000000012085cf54 __RELEASE_OBJECTS_IN_THE_SET__ + 144
    32  CoreFoundation                      0x000000012085ce7d -[__NSSetM dealloc] + 130
    33  libobjc.A.dylib                     0x0000000117672228 _ZN11objc_object17sidetable_releaseEbb + 204
    34  UIKitCore                           0x0000000140026766 -[_UILayoutArrangement .cxx_destruct] + 128
    35  libobjc.A.dylib                     0x0000000117652766 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
    36  libobjc.A.dylib                     0x000000011766adfc objc_destructInstance + 61
    37  libobjc.A.dylib                     0x000000011767176c -[NSObject dealloc] + 19
    38  UIKitCore                           0x000000014001d85e -[_UIAlignedLayoutArrangement dealloc] + 325
    39  libobjc.A.dylib                     0x0000000117672228 _ZN11objc_object17sidetable_releaseEbb + 204
    40  CoreFoundation                      0x0000000120725152 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 124
    41  CoreFoundation                      0x000000012072508f -[__NSArrayM dealloc] + 130
...
...

I'm also seeing these crashes in Crashlytics. Only iOS 17 Beta users are affected. I was unable to reproduce this issue.

Hi, I had the same problem。 Then I repeated the question。 for the following reasons:

look this code:

0 [self.view bringSubviewToFront:self.educationView]; 1 [_educationView buildCustomView];

Line 0: self.educationView Is a lazy load, therein create the UI, and also call buildCustomView method, (There is customization UITextFiled involved in this method) Line 1: It's called again the buildCustomView method

A crash occurs when the UITextField is released through the stack discovery, So I commented Line 1 code out, Then the problem was solved。 You can check to see if such code exists

Solved in latest Xcode beta 8

"I still have this problem. Help me

iOS 17 Beta crash: -[NSCountableTextLocation compare:] receiving unmatching type (null)
 
 
Q