Our application supports portrait mode only. Represents the operation of the UIActivityViewController.
However, sharing with the "Message" option causes the application to crash:
*** Application termination due to the uncaught exception "UIApplicationInvalidInterfaceOrientation", reason: "Supported orientations do not have a common orientation with the application, and [MFMessageComposeViewController shouldAutorotate] returns YES '
Another option works, for example, Facebook Messenger.
Solutions from similar SO issues like this one do not work, as they offer support for all orientations. We want to support only a portrait.
1) How can we support the "Community" option, only supporting portrait orientation, that is, only supporting portrait orientation in Info.plist?
2) Why can we support the "Message" option in other applications only with portrait orientation in Info.plist, but not with this? Where should we look for debugging goals?
// 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)
source share