Bug 34794 - Override for UIInterfaceOrientationMask does not seem to be called on iPad 64bit
Summary: Override for UIInterfaceOrientationMask does not seem to be called on iPad 64bit
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 9.4 (iOS 9.2)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-10-12 23:45 UTC by Cody Beyer (MSFT)
Modified: 2015-10-14 04:21 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Xcode test case (41.79 KB, application/zip)
2015-10-13 07:30 UTC, Rolf Bjarne Kvinge [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Cody Beyer (MSFT) 2015-10-12 23:45:45 UTC
### Description

Using an override for UIInterfaceOrientationMask to set forced orientation does not appear to be called on iPad Air

### Sample

https://www.dropbox.com/s/wfb2wi3490c0nvs/Jonathan%20Peppers%20-%20OrientationRepro.zip?dl=0

### Steps to Reproduce

1. Download sample
2. Run on iPad Air

### Expected Results

Should be forced landscape

### Actual Results

Is Portrait

### Versions

=== Xamarin Studio ===

Version 5.9.7 (build 22)
Installation UUID: 8ac4d87c-b82f-42fd-84d6-d10de207b0c8
Runtime:
	Mono 4.0.4 ((detached/d481017)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040004

=== Xamarin.Android ===

Version: 5.1.7.12 (Business Edition)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.0.1 (8228)
Build 7A1001

=== Xamarin.iOS ===

Version: 9.0.1.29 (Business Edition)
Hash: 1d27ac2
Branch: master
Build date: 2015-09-25 18:08:44-0400

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509070022
Git revision: 6bd1f169df44ca96addf8a035316c535a4fa46fa
Build date: 2015-09-30 12:30:15-04
Xamarin addins: 1c3e5c0859bdfec0ecd481a57ad6c03bc22f5536

=== Operating System ===

Mac OS X 10.11.0
Darwin Codys-MacBook-Pro.local 15.0.0 Darwin Kernel Version 15.0.0
    Wed Aug 26 16:57:32 PDT 2015
    root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-10-13 07:29:18 UTC
I can reproduce this with the attached sample, but I can also reproduce it with an Xcode sample, so it's not a bug in Xamarin.iOS.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2015-10-13 07:30:06 UTC
Created attachment 13306 [details]
Xcode test case
Comment 3 Jonathan Peppers 2015-10-13 09:16:59 UTC
Hi Rolf,

In your Objective-C example, do need to change this method:

-(NSUInteger) supportsInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

To this:

-(UIInterfaceOrientationMask) supportsInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

See here: https://forums.developer.apple.com/thread/6165
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-10-13 12:37:41 UTC
@Jonathan, I tried it, and it doesn't change the outcome.
Comment 5 Jonathan Peppers 2015-10-13 12:58:47 UTC
Whoops, you have a typo in your Xcode project, it should be:

- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

If I use this in your Xcode project instead, it is working on both a 32-bit iPad mini and a 64-bit iPad air.

So what I'm seeing in a Xamarin project is that the function isn't getting called on 64-bit devices, so iOS allows the controller to rotate.
Comment 6 Jonathan Peppers 2015-10-13 13:09:53 UTC
Ok, I kept trying it and it is still happening in an Xcode project.

I found a radar open about this: https://openradar.appspot.com/22854526
Comment 7 Rolf Bjarne Kvinge [MSFT] 2015-10-13 13:12:36 UTC
I just tested as well, and I can also reproduce with my Xcode project (which I put here now: https://github.com/rolfbjarne/bug34794)
Comment 8 Jonathan Peppers 2015-10-13 14:29:20 UTC
Ok, thanks for the help, I figured out what Apple did that broke this.

If you have Xcode 7, you need to add UIRequiresFullScreen = YES to Info.plist:

http://stackoverflow.com/questions/32359775/unable-to-lock-orientation-on-ipad-air-2

I tested and this solution works in both Xcode and Xamarin.iOS. The Hanx Writer app doesn't need multi-tasking at the moment (maybe never), so this solution works fine for us.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2015-10-14 04:21:19 UTC
That's interesting, and thanks for the follow-up!