LeoMaer LeoMaer - 1 year ago 45
iOS Question

iOS: Tap cancel in Messages app to go back to app that invoked it

Our team manager has proposed the following idea: within our app, when a user taps a

Send Msg
button, our app opens up the Messages app. Our manager wants to tap
to go back to our app (see screenshot below), instead of the top left
Go back to ...
shortcut in the status bar. Is that possible?

This is the picture:
red frame show


If you are opening the message editor externally, that is, you just open the default Message app (I guess this is what is happening, otherwise there wouldn't be the Back button at top left corner), unfortunately I'm not aware of any way to go back to your app when clicking the Cancel button.

However, if you are using MFMessageComposeViewController, which probably is a good idea as your users don't have to leave your app, it would be definitely possible to act accordingly when users choose to cancel.

You can take a look at Apple's doc here, which utilizes mailComposeController:didFinishWithResult:error:

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller
             didFinishWithResult:(MessageComposeResult)result {
   // Check the result or perform other tasks.

   // Dismiss the mail compose view controller.
   [self dismissViewControllerAnimated:YES completion:nil];