I work on the iMessage App and stumbled upon this nasty bug. I would really appreciate the power of the community. Did anyone manage to solve it?
- A clear description of the problem:
I work on a Standalone iMessage App. When the iMessage app is active but hidden below the keyboard tapping on the message from that extension opens an app with an empty screen. Investigation of this problem led me to the conclusion that there is no UIWindow attached to the window property of the view in the MessagesViewController. Also, the MessagesViewController is not displayed in the view hierarchy, and MessagesViewController life cycle methods like viewDidLoad and viewDidAppear are not called.
- A step-by-step set of instructions to reproduce the problem:
- Open an iMessage App (for example Youtube) and send a message from that app to a chat.
- Open the iMessage App again
- Scroll up so that the iMessage App gets hidden below the keyboard
- Scroll down to find a message that you’ve sent in step 1
- Tap on the message
- The app will expand with an empty view
Here is the bug reproduced in Apple's iMessage Example App https://youtube.com/shorts/3UGyZimctSg?feature=share
I also came across this bug and can reproduce the issue in Apple's sample app as well as every iMessage app on the app store I've tested, except for GamePigeon.
The issue is that the
MSMessagesAppViewController's view is not part of anyUIWindowhierarchy when you try to reopen the app, but it still has it'sparentproperty. So I came up with this workaround:Since the ViewController has no window, it doesn't get standard life cycle events like you said, but
didTransition(to presentationStyle: MSMessagesAppPresentationStyle)still gets called so that's where I've put this.