简体   繁体   中英

Debugging a strange crash - NSInternalInconsistencyException

I'm having a strange crash with my application (only with iPad's 9.x) and I'm unsure how I can debug it, because the logs are not helping to discover what is happening.

The strangest thing is that the log shows Auto layout internal error , but my application does not have Auto Layout turned on.

Anyone have any idea how to debug whats causing it?


在此输入图像描述


Part of the code that I think is responsible for the crash:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapBackground:)];
    [self.ivBackground addGestureRecognizer:tap]; // UIImageView (background)
}

- (void)tapBackground:(UITapGestureRecognizer*)tap
{
    [self.view endEditing:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}

From the crash log you can see that it has to do with the device's keyboard. Could you please expand the crash log between lines 4 and 36 or upload the full crash log so I can take a look. Thanks

It's also flagged as a bug! inside the crash log.

Update:

After checking the full log, it looks like a single finger tap

20 -[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:]

is causing the textField to become first responder, which is setting up the keyboard, but at the same time the gesture has triggered the endEditing and the dismissal of the viewController.

The keyboard is crashing the app as the textField has been removed before the Autolayout has finished setting up.

I would relook at how you structure your views and the gesture, and how you dismiss or close that VC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM