Creating a email extension for ios... it keeps flipping the orientation of the app when closing.
I know, if I need help I should go post on some apple board... but it's information overflow.... and I am not 100% sure it's related to the extension.
Here's the problem
I am creating/using an extension to open the MFMailComposeViewController.
Now, I figured out how to open it and force it to landscape, but the problem is when I close the email it, my app flips upside down. (landscape left when it was landscape right before, or vice versa)
My app is set to force landscape left and right... and the mail controller does open in landscape... but it's either upside down (landscape right, when the app is left, or vice versa) or when it closes, it flips the application the other way.
Has anyone encountered anything like this and ideas on how to fix it?
My app publish settings, I set to landscape, auto-orient is set to false and it's full screen,
However, on start up in code... I am setting stage.autoOrients = true and then using the CustomOrientation.as to control the rotation (to force landscape only)
in my extension, I am showing the MFMailComposeViewController in the
[[[[UIApplication sharedApplication] keyWindow] rootViewcontroller] presentModalViewcontroller:mailCompser animated:NO];
and mailCompser is a subclassed MFMailComposeViewcontroller object and I have set it's override to this:
@implementation MailCompose
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
When I launch my app, it starts
stage.orientation = rotatedRight
I then launch my extension and the email page for ios appears, in the correct orientation.... if I rotate the device, both the email and the app rotate to rotatedRight or rotatedLeft correctly.
I then click Cancel, delete draft
The email window disappears, but now my screen is landscape left.... if I wiggle the device, the sensor picks it up and then rotates the app back right, but this is a major problem.
I am thinking it has something to do with the rootViewController orienatation, but I don't know enough about objC and xcode to know what to do.
I have tried googling and searching will little to no luck... but then, the answer could be staring at me and I would have missed it as I am an obj c noob.
Anyone know how I can fix this?
