Bug 28787 - GetSupportedInterfaceOrientations is never called in PageRenderer subclass in iOS
Summary: GetSupportedInterfaceOrientations is never called in PageRenderer subclass in...
Status: RESOLVED FEATURE
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.1
Hardware: Macintosh Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-04-05 11:43 UTC by Ed
Modified: 2016-05-28 01:24 UTC (History)
8 users (show)

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


Attachments
MyPageRenderer.GetSupportedInterfaceOrientations with Debugger.Break() (179.93 KB, application/zip)
2015-04-07 02:36 UTC, Ed
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 FEATURE

Description Ed 2015-04-05 11:43:03 UTC
GetSupportedInterfaceOrientations is never called in PageRenderer subclass in iOS.

Here is the code:

[assembly: ExportRendererAttribute(typeof(MainPage), typeof(MainPageRenderer))]

namespace MyApp.iOS
{
    public class MainPageRenderer : PageRenderer
    {
        public override bool ShouldAutorotate()
        {
            return true;
        }

        public MainPageRenderer()
        {
        }

        [Export("application:supportedInterfaceOrientationsForWindow:")]
        public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application, IntPtr forWindow)
        {
                return UIInterfaceOrientationMask.LandscapeLeft;
        }
    }
}
Comment 1 Adam Kemp 2015-04-05 13:30:10 UTC
I believe this is the root cause:  https://bugzilla.xamarin.com/show_bug.cgi?id=28388

This particular effect of that bug is worse because I don't see how to work around it.
Comment 2 Ed 2015-04-07 02:36:44 UTC
Created attachment 10650 [details]
MyPageRenderer.GetSupportedInterfaceOrientations with Debugger.Break()

Compile project and run under debugger in simulator to see if GetSupportedInterfaceOrientations() is called. Check GetSupportedInterfaceOrientations() in MyPageRenderer class, it has Debugger.Break() inside. It will stop there if GetSupportedInterfaceOrientations() gets called.
Comment 3 Parmendra Kumar 2015-04-07 13:48:35 UTC
I have checked this issue and I am also getting same behavior mentioned in the bug description.

Screencast: http://www.screencast.com/t/rZlcwYxN

IDE Log: https://gist.github.com/Parmendrak/1534d9aaa222a9d75a85
Device Log: https://gist.github.com/Parmendrak/fe3c4cb94d83a29fe41a
Build Output: https://gist.github.com/Parmendrak/9ee941c7c0ed76461249
App Output: https://gist.github.com/Parmendrak/3a65e3068fa74c09cdd2


Environment info:

=== Xamarin Studio ===

Version 5.9 (build 395)
Installation UUID: 1a096c6f-0678-402e-89b2-a2c10f7e80e4
Runtime:
	Mono 4.0.0 ((detached/21d849b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000121

=== Xamarin.Android ===

Version: 5.1.0.102 (Business Edition)
Android SDK: /Users/360_macmini/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Xamarin Android Player ===

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

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.Mac ===

Version: 2.0.0.200 (Business Edition)

=== Xamarin.iOS ===

Version: 8.10.0.200 (Business Edition)
Hash: 604557f
Branch: master
Build date: 2015-04-03 02:30:26-0400

=== Build Information ===

Release ID: 509000395
Git revision: 615c278e64a991a45e544ba83aec1e086988816e
Build date: 2015-04-03 11:58:32-04
Xamarin addins: 0ae4a1cee0fa2721e8f5e4bdaded0ebc95fe7d57

=== Operating System ===

Mac OS X 10.9.4
Darwin ShrutiMac.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 4 Samantha Houts [MSFT] 2016-05-28 01:01:22 UTC
Thank you for taking the time to submit this feature request. We like this idea and have added it to our internal feature tracking system.

Warm regards,
Xamarin Forms Team
Comment 5 Adam Kemp 2016-05-28 01:24:19 UTC
I'm not sure why you would consider fixing this but not the underlying problem (linked above), which Jason said would NOT be fixed. Seems easier to fix the root cause, which would fix not only this but a whole slew of other problems people have encountered in custom page renderers.