Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is another case this error message may appear. I was searching for hours until I found the problem. This thread was very helpful after reading it a couple of times.</p> <p>If your main view controller is rotated to landscape orientation and you invoke a custom sub view controller which should be displayed in portrait orientation this error message can happen when your code looks like this:</p> <pre><code>- (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationPortrait; } </code></pre> <p>The trap here was xcode's intellisense suggested "UIInterfaceOrientationPortrait" and I didn't care about it. At the first glance this seemed to be correct.</p> <p>The right mask is named</p> <pre><code>UIInterfaceOrientationMaskPortrait </code></pre> <p>Be aware of the small infix <strong>"Mask"</strong>, else your subview will end up with an exception and the mentioned error message above.</p> <p>The new enums are bit shifted. The old enums return invalid values!</p> <p>(in UIApplication.h you can see the new declaration: <em>UIInterfaceOrientationMaskPortrait = (1 &lt;&lt; UIInterfaceOrientationPortrait)</em> )</p> <p>The solution is:</p> <pre><code>- (BOOL)shouldAutorotate { return YES; } - (NSUInteger)supportedInterfaceOrientations { // ATTENTION! Only return orientation MASK values // return UIInterfaceOrientationPortrait; return UIInterfaceOrientationMaskPortrait; } </code></pre> <p>In swift use</p> <pre><code>override func shouldAutorotate() -&gt; Bool { return true } override func supportedInterfaceOrientations() -&gt; Int { return Int(UIInterfaceOrientationMask.Portrait.rawValue) } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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