Search code examples
ioscrashuiaccessibilityhockeyapp

iOS 9.1 Crashes App when Accessibility Inspector is On


I am using HockeyApp for crash reporting. I noticed a crash that is happening frequently and only with iOS 9.1. The crash occurs when a text field becomes the first responder which also triggers a UITableView delegate to be set. At first I struggled to reproduce, but now I can reproduce all the time. All I have to do is turn on the Accessibility Inspector and my app will crash. The reason for the crash is, "Reason: Selector name found in current argument registers: _accessibilitySetRetainedValue:forKey:" and it the crash is a "SIGSEGV". Any thoughts on how this can be fixed?


Solution

  • We ran into something similar that wound up being caused due to something like the following:

    @property (nonatomic, strong) id<UITableViewDelegate> delegate;
    @property (nonatomic, strong) UITableVIew *tableView;
    
    ...
    
    self.delegate = newDelegate;
    self.tableView.delegate = newDelegate;
    

    The original delegate gets deallocated, which normally wouldn't be an issue. But as far as we can tell, when accessibility is enabled, something in there has an assign reference to the original delegate, and when the new delegate is set, there's something that tries to clear that reference. Which doesn't exist anymore.

    TL;DR: Don't deallocate the original delegate before assigning the new one to the tableview:

    self.tableView.delegate = newDelegate;
    self.delegate = newDelegate;