Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12029] iPad - OpenPhotoGallery does not work when Orientation mode is Landscape.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-02-11T21:17:44.000+0000
Affected Version/sRelease 3.1.0
Fix Version/sRelease 3.2.0
ComponentsiOS
Labelsqe-closed-3.2.2, supportTeam
ReporterAmuktha Akkinepally
AssigneeIngo Muschenetz
Created2012-12-11T21:49:42.000+0000
Updated2014-03-10T11:06:19.000+0000

Description

The Ti.Media.openPhotoGallery() does not work on iPad only when the app is set to landscape-only orientation on tiapp.xml, It works fine in portrait mode. Steps to reproduce: 1. Load the below app.js and make the given changes in tiapp.xml. 2. Install the app on a device and click on here button Expected result: It should open up the gallery Actual Result: It does not open up the gallery

app.js

var btn = Ti.UI.createButton({
    title:'here'
});

var win = Ti.UI.createWindow({
    backgroundColor: '#ccc',
    rightNavButton: btn,
    orientationModes: [Ti.UI.LANDSCAPE_LEFT,Ti.UI.LANDSCAPE_RIGHT]
});


btn.addEventListener('click', function(){
    Ti.Media.openPhotoGallery({
        popoverView: this
    });
});

win.open({
    modal: true
});

tiapp.xml

<orientations device="ipad">
    <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
    <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
</orientations>

Comments

  1. Pedro Enrique 2012-12-12

    This appears to be an iOS bug rather than Titanium. The UIImagePickerController allows for all four orientations, and apparently it relies somehow on the top most view controller's orientation. I created a "hello world" native app and when locked in one orientation the app crashed while trying to present the popover with the image gallery. After reading a bit about this on [StackOverflow](http://stackoverflow.com/questions/12540597/supported-orientations-has-no-common-orientation-with-the-application-and-shoul), I added these likes of code to the MediaModule.m to extend it and it started to work as expected.
       
       // This category (i.e. class extension) is a workaround to get the
       // Image PickerController to appear in landscape mode.
       @interface UIImagePickerController(Nonrotating)
       - (BOOL)shouldAutorotate;
       @end
       
       @implementation UIImagePickerController(Nonrotating)
       
       - (BOOL)shouldAutorotate {
         return NO;
       }
       
       @end
       
  2. jithinpv 2013-03-25

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 (03/11/13 15:43 0c88429) Titanium SDK version: 3.0.2 (02/07/13 16:46 a4def81) iOS iPhone Simulator: iOS SDK version: 6.0
  3. Shak Hossain 2014-02-11

    Closing since the issue is not reproducible anymore since TISDK 3.2 or higher.
  4. Neha Mittal 2014-03-10

    Tested with both the codes provided in the Description and comments.Issue is not reproducible using below environment: Environment: Appc Studio: 3.2.2.201402280732 Sdk: 3.2.2.v20140221161255 acs: 1.0.14 npm: 1.3.2 alloy:1.3.1 titanium:3.2.1 titanium-code-processor:1.1.0 Xcode: 5.1-beta5 Osx: Maverick(10.9.2) Device: iPad 3 (iOS 7.1) and iPhone 5S(iOS 7.1) OpenPhotoGallery is working fine with Landscape orientation mode.Hence closing the issue.

JSON Source