Note that there are some explanatory texts on larger screens.

plurals
  1. POshouldAutorotateToInterfaceOrientation doesn't work on first launch after fresh app install
    primarykey
    data
    text
    <p>When the app I'm working on is installed either via Ad-Hoc thru iTunes or built directly to the device, upon launching for the first time, the only view controller in my app that responds to orientation changes doesn't receive calls to <code>shouldAutorotateToInterfaceOrientation:</code> with a landscape argument passed in; debugging shows that it's only being called for portrait. Every subsequent launch behaves as I would expect - that is, there are calls to <code>shouldAutorotateToInterfaceOrientation:</code> made both with landscape and portrait arguments. This exact behavior can be seen in the iPhone simulator, on the iPhone and on the iPod touch.</p> <p>So my question is: why would orientation notifications be different for the first launch of an app than they would be for every subsequent launch? Am I mistaken in believing that I have no control over orientation changes beyond responding to <code>shouldAutorotateToInterfaceOrientation:</code>?</p> <p>Inside the ViewController in question: </p> <pre> - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { return YES; } </pre> <p>and inside of <code>viewDidLoad</code> and <code>viewDidUnload</code> I've got (respectively): <pre> [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; </pre> and</p> <pre> [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; </pre> <p><b> Update July 6, 2010: </b></p> <p>Still no luck solving the problem. I dropped the issue for a little while and came back to it and am still seeing the problem under completely different circumstances. Anyone?</p> <p><b> Update July 13, 2010: </b></p> <p>From Apple's <a href="http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/BasicViewControllers/BasicViewControllers.html#//apple_ref/doc/uid/TP40007457-CH101-SW23" rel="nofollow noreferrer">View Controller Programming Guide</a>:</p> <p>"...the window object does much of the work associated with changing the current orientation. [...] Specifically, it works with the view controller whose root view was most recently added to, or presented in, the window. In other words, the window object works only with the frontmost view controller whose view was displayed..."</p> <p>I'm adding the root view controller to the window differently on the first launch compared to every subsequent launch, so I thought maybe it had something to do with this. I have yet to trace anything back to here though...just a thought.</p> <p>This thing has had around 175 views at the time of this update...no one has even the most far out obscure suggestion? Come on, throw something out there. I'm willing to entertain any guesses or suggestions at this point. I don't care if it's stupidly obscure or potentially irrelevant.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload