slackhq / SlackTextViewController

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features
https://slack.com/
MIT License
8.32k stars 1.08k forks source link

Crash when using SLKTextViewController with extra UITextView #339

Closed kevinrenskers closed 8 years ago

kevinrenskers commented 8 years ago

I'm using SLKTextViewController but have more textviews (UITextView) in my controller. This is now causing a crash here: https://github.com/slackhq/SlackTextViewController/blob/master/Source/SLKTextViewController.m#L1864

-[UITextView autoCompleteFormatting]: unrecognized selector sent to instance

The delegate in SLKTextViewController should probably check if the textview is an instance of SLKTextView.

Broke in 1.8.0, worked fine in 1.7.2.

kevinrenskers commented 8 years ago

Workaround: I'm using a subclass of SLKTextViewController and have added this code:

- (BOOL)textView:(SLKTextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    if ([textView isMemberOfClass:[SLKTextView class]]) {
        return [super textView:textView shouldChangeTextInRange:range replacementText:text];
    }

    return YES;
}
dzenbot commented 8 years ago

Good point! Will add the check for SLKTextView. Didn't anticipate the usage of other subclasses of UITextView.