Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Very Intermittent Orientation on Device & Simulator

Tags:

uikit

iphone

I've noticed that I'm getting very intermittent orientation on my device & the simulator.

I have a modal view controller that I present, and that is the only thing in my app which supports rotation.

If I launch the app in portrait without moving the device, open the modal VC and then rotate the device, it usually works. However sometimes if I open the app holding the device in landscape, then rotate to portrait, launch the VC and then rotate the device, no rotation occurs. It seems very intermittent. Sometimes if I launch the app in portrait mode and then open the VC and rotate the device, nothing happens, and until I quit and relaunch it no orientation occurs in the app.

It's strange because 50% of the time it works! Whenever I launch it through Xcode and set breakpoints in shouldAutorotateToInterfaceOrientation it always works!

Anyone ever had this or know what's going on?

like image 307
Michael Waterfall Avatar asked Nov 25 '22 21:11

Michael Waterfall


1 Answers

Since as you mentioned "intermittent", i would say it has something to do with what are you doing after the rotation.

To find the bug, i suggest removing any code after the rotation happens. Comment out any network activities or OpenGL operations. Could also help to close XCode and reopen it.

If nothing helps, i would make a new project and start moving the files one by one and test.

like image 110
medopal Avatar answered Feb 05 '23 03:02

medopal