Our app only supports portrait mode. Presenting a UIActivityViewController works.
However, sharing with the "Message" option crashes the app:
*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [MFMessageComposeViewController shouldAutorotate] is returning YES'
Sharing with another option, such as Facebook Messenger, works.
Solutions from similar SO questions like this one do not work since they suggest supporting all orientations. We only want to support portrait.
1) How can we support the "Message" share option while only supporting portrait orientation, that is while only supporting portrait orientation in Info.plist?
2) Why are we able to support the "Message" share option in other apps with only portrait orientation in Info.plist but not this one? Where should we look for debugging purposes?
// Define share objects
let objectsToShare = ["test message"] as [Any]
// Configure UIActivityViewController
let activityViewController = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
activityViewController.excludedActivityTypes =
[UIActivityType.addToReadingList,
UIActivityType.assignToContact,
UIActivityType.print,
UIActivityType.copyToPasteboard]
// Define completion handler
activityViewController.completionWithItemsHandler = doneSharingHandler
// Show UIActivityViewController
present(activityViewController, animated: true, completion: nil)
UIActivityViewController
. They're all portrait only apps, and I've never seen this issue before with Messages, Mail, or any other sharing option. So, my suggestion to you would be to further examine where exactly the app crashes. I think you should reexamine your code and make sure you aren't doing something elsewhere in your code to cause this problem. I – Karlotte