So iMessage doesn’t like it when you try to open a keyboard in compact view.

It also doesn’t like it if you swipe to another iMessage app by touching a search bar or text field, as that activates the keyboard and kills the composer.

The way to fix this is to not allow the keyboard to show while in compact view. I did this by setting a flag in the ViewController that houses the searchbar, and then only responding YES to shouldBegin editing if this was set.

MessageViewController.m

- (void)willTransitionToPresentationStyle:(MSMessagesAppPresentationStyle)presentationStyle
{
    if (presentationStyle == MSMessagesAppPresentationStyleCompact) {
        self.searchViewController.isPresentationStyleCompact = YES;
        [self presentViewController:self.searchViewController];
    } else {
        self.searchViewController.isPresentationStyleCompact = NO;
    }
}

SearchViewController.m

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
    if (self.isPresentationStyleCompact) {
        return NO;
    } else {
        return YES;
    }
}

Links

http://stackoverflow.com/questions/39361172/imessage-app-crash-in-expanded-mode-with-keyboard-of-textfield

https://forums.developer.apple.com/thread/52850

Advertisements