Xcode12 iOS14 crash in [NSObject+ doesNotRecognizeSelector:] + 143

iPhone OS 14.0 (18A373)
iPhone11,8
Application Specific Information:
abort() called

Last Exception Backtrace:
0 CoreFoundation 0x1b093a5ac _exceptionPreprocess + 220
1 libobjc.A.dylib 0x1c49b442c objc
exceptionthrow + 59
2 CoreFoundation 0x1b0844a2c -[NSObject+ 178732 (NSObject) doesNotRecognizeSelector:] + 143
3 UIKitCore 0x1b328b840 -[UIResponder doesNotRecognizeSelector:] + 287
4 CoreFoundation 0x1b093d130
forwarding + 1443
5 CoreFoundation 0x1b093f420
CFforwardingprep0 + 95
6 UIAccessibility 0x1c3d276f0 -[UIView+ 63216 (UIAccessibilityElementTraversal)
addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 467
7 UIAccessibility 0x1c3d279b8 -[UIView+ 63928 (UIAccessibilityElementTraversal) addAccessibilityElementsAndOrderedContainersWithOptions:toCollection:] + 1179
8 UIAccessibility 0x1c3d27eb4 +[UIView+ 65204 (UIAccessibilityElementTraversal)
accessibilityElementsAndContainersDescendingFromViews:options:sorted:] + 495
9 UIAccessibility 0x1c3d28118 -[UIView+ 65816 (UIAccessibilityElementTraversal) accessibilityViewChildrenWithOptions:] + 211
10 UIKit 0x1f8137498 -[UITableViewCellAccessibility
accessibilityRetrieveTableViewCellTextWithLocalizationOptions:shouldExcludeDetailText:] + 1367
11 UIKit 0x1f8138074 -[UITableViewCellAccessibility accessibilityChildren] + 1167
12 PassKitUI 0x12b724178 0x12b70c000 + 98680
13 UIKit 0x1f81399d0 -[UITableViewCellAccessibility accessibilityElementCount] + 191
14 UIKit 0x1f80bb874 -[UIApplicationAccessibility
accessibilityResponderElement:] + 2091
15 UIAccessibility 0x1c3d57bdc _98-[NSObject+ 261084 (AXPrivCategory) accessibilityPostValueChangedNotificationWithChangeType:insertedText:]blockinvoke + 71
16 libdispatch.dylib 0x1b0536fd0 dispatchcallblockandrelease + 31
17 libdispatch.dylib 0x1b0538ac8
dispatchclientcallout + 19
18 libdispatch.dylib 0x1b054604c dispatchmainqueuecallback4CF + 835
19 CoreFoundation 0x1b08b71e4 CFRUNLOOP
ISSERVICINGTHEMAINDISPATCHQUEUE + 15
20 CoreFoundation 0x1b08b13b4
CFRunLoopRun + 2507
21 CoreFoundation 0x1b08b04bc CFRunLoopRunSpecific + 599
22 GraphicsServices 0x1c7335820 GSEventRunModal + 163
23 UIKitCore 0x1b3254734 -[UIApplication
run] + 1071
24 UIKitCore 0x1b3259e10 UIApplicationMain + 167
25 XXXXX 0x106bf7ce8 main + 41745640 (main.m:15)
26 libdyld.dylib 0x1b0577e60 start + 3

 Could you tell me the crash reason?How can I fix it.Thanks.


Frames 0 through 5 indicate that your app crashed due to a type mismatch problem. In frame 6 a method within UIKit is trying to call a method on some object. This object doesn’t implement that method, resulting in a deliberate crash within the Objective-C runtime. This is usually because the called object is the wrong type.

Do you have a full Apple crash report for the crash? If so, please post it here. Use a text attachment (the paperclip button) to avoid clogging up the timeline.

A common cause of problems like this is memory management issues. If you over-release an object and then the same memory is used by an object of a different type, code that still has a reference to the old object may crash like this. The standard memory debugging tools can help flush out such problems.

ps If you use code block syntax (triple backticks) for code blocks, they’re much easier to read (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Exception Type: EXCCRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC
CORPSE_NOTIFY
Triggered by Thread: 0

As mentioned, this doesn't seem like a memory problem.This crash is not inevitable and only happens in ios14.

As mentioned, this doesn't seem like a memory problem.

You have misunderstood my reasoning. I’m not saying that it’s a memory access exception, which would manifest as an EXC_BAD_ACCESS exception. Frames 0 and 1 of your crash report make it clear that it’s an unhandled language exception, which is why you’re seeing SIGABRT. However, frames 2 through 5 indicate thaht the specific exception being raised is the ‘does not recognise selector’ exception, and a common cause for those is over releasing an object. Hence my recommendation that you deploy the standard memory debugging tools, and specifically zombies.

This crash is not inevitable

Right. That’s one benefit of the standard memory debugging tools: They can turn hard-to-reproduce problems into a guaranteed trap.

This crash … only happens in ios14.

Fair enough, but that doesn’t affect my conclusion. This may well be a memory management problem in the OS itself. Either way, the standard memory debugging tools are the obvious next step.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
I can not find any Zombie object by XCode instrument.
I add some textfield in dataSourceViews and display textfield on XXCellTableViewCell.But when I input some character in textField on some iOS14 device(only in iOS14 not all of iOS14.I don't have such device around me.But my clients always complain to me about the crash),the app may crash.
If it proves that this is OS memory management problem, how can I fix it.

Code Block
#import "Masonry.h"
@interface XXXXConfirmViewController ()
@property(nonatomic,strong) NSMutableArray <UITextField *> *dataSourceViews;
@property(nonatomic,strong) UITextField *nameField;
@property(nonatomic,strong) UITextField *noField;
@property(nonatomic,strong) UIButton *nextBtn;
@end
static NSString *XXCellIdentifier = @"XXCellIdentifier";
@implementation XXXXConfirmViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.dataSourceViews = [[NSMutableArray alloc] initWithCapacity:1];
 self.nameField = [[UITextField alloc] init];
    [self.dataSourceViews addObject:self.nameField];
     
    self.idNoField = [[UITextField alloc] init];
    [self.dataSourceViews addObject:self.idNoField];
for (UITextField *field in self.dataSourceViews) {
[field addTarget:self action:@selector(changeConfirmToPayButtonStatus) forControlEvents:UIControlEventEditingChanged];
[field addTarget:self action:@selector(changeConfirmToPayButtonStatus) forControlEvents:UIControlEventValueChanged];
[field addTarget:self action:@selector(fieldDidBeginEditing:) forControlEvents:UIControlEventEditingDidBegin];
}
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
self.tableView.backgroundColor = [UIColor whiteColor];
[self.tableView registerClass:[XXCellTableViewCell class] forCellReuseIdentifier:XXCellIdentifier];
}
- (void)changeConfirmToPayButtonStatus
{
  self.nextBtn.enabled = YES;
  [self.dataSourceViews enumerateObjectsUsingBlock:^(UITextField *obj, NSUInteger idx, BOOL *stop) {
   
    if ([obj.text isEqualToString:@""]) {
      self.nextBtn.enabled = NO;
    }
     
   
  }];
}
- (void)fieldDidBeginEditing:(UITextField *)textField
{
  
   //do statistics
   
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
XXCellTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:XXCellIdentifier forIndexPath:indexPath];
cell.textField = self.dataSourceViews[indexPath.row];
return cell;
}
@end
@interface XXCellTableViewCell : UITableViewCell
@property(nonatomic,strong) UITextField *textField;
@property(nonatomic,strong) UIView *line;
@end
@implementation XXCellTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if(self){
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
CGFloat lineWidth = 1.0/[[UIScreen mainScreen] scale];
self.line =[[UIView alloc] init];
self.line.backgroundColor = [UIColor redColor];
[self.contentView addSubview:self.line];
[self.line mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(lineWidth);
make.left.bottom.right.equalTo(self);
}];
}
return self;
}
- (void)setTextField:(UITextField *)newTextField
{
[_textField removeFromSuperview];
_textField = newTextField;
[self.contentView addSubview:_textField];
[_textField mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(16);
make.height.mas_equalTo(44);
make.centerY.equalTo(self);
make.right.equalTo(self).offset(-10);
}];
}
@end

Xcode12 iOS14 crash in [NSObject&#43; doesNotRecognizeSelector:] &#43; 143
 
 
Q