Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11338] iOS6 on iPad: Ti.Media.openPhotoGallery doesn't work and blocks app

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionNot Our Bug
Resolution Date2012-10-11T01:46:09.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2012 Sprint 21 API, 2012 Sprint 21
ComponentsiOS
Labelsios6, ipad, media, openPhotoGallery, to-triage
ReporterFokke Zandbergen
AssigneeSabil Rahim
Created2012-09-20T06:11:51.000+0000
Updated2013-03-27T22:55:20.000+0000

Description

Steps to reproduce the issue

Execute the attached app.js

Click the 'openPhotoGallery' button

Close the first alert telling 'I will now call Ti.Media.openPhotoGallery'

Notice there is no gallery opening

Try to click the 'click me later' button

Notice you cannot click it because the app (by some invisible layer?) is blocked

Attachments

FileDateSize
app_no_alert.js2012-10-08T15:43:38.000+0000767
app.js2012-09-20T06:11:51.000+0000677
Pfixx.zip2012-09-20T23:59:58.000+00001576172
Screenshot 2012.09.20 12.21.30.png2012-09-20T12:38:20.000+0000292306
Screenshot 2012.09.20 12.21.41.png2012-09-20T12:38:20.000+0000349656
Screenshot 2012.09.20 12.21.50.png2012-09-20T12:38:21.000+0000300038
Screenshot 2012.09.20 12.26.25.png2012-09-20T12:38:21.000+0000520179
Testing.zip2012-09-20T23:59:17.000+00003121995

Comments

  1. Eric Merriman 2012-09-20

    Attempted to reproduce in iPad iOS 6.0 simulator and initially got a failure in studio console:
       [WARN] Exception in event callback. {
           line = 22;
           message = "'undefined' is not an object (evaluating 'Ti.Media.openPhotoGallery')";
           name = TypeError;
           sourceId = 225323488;
           sourceURL = "file://localhost/Users/emerriman/Library/Application%20Support/iPhone%20Simulator/6.0/Applications/5F3C7612-FAF8-4376-8A12-32DF86F5CEBB/testingBug.app/app.js";
       }
       
    Second attempt worked as expected. Also to note, the simulator privacy setting for photos did not contain a request from my test app for access to photos. The gallery was empty. On device, test code worked as expected for me, see screen shots. App requested access to photo gallery and when I approved, setting entry was made in privacy>photos for my test app and was set to allow access.
  2. Eric Merriman 2012-09-20

    For comment above, I am running: Mountain Lion 10.8.1 Xcode 4.5 GM iOS 6.0 GM for iPad 3 Titanium Studio, build: 2.1.2.201208301612 SDK: 2.1.3.v20120918170114
  3. Fokke Zandbergen 2012-09-21

    The debug code pasted in a newly created project works indeed.. just like Eric found. But in my earlier created project, now upgraded to SDK 2.1.3 RC it does not! Compare the two newly attached ZIPs containing both projects. In the Pfixx project I stripped all other code and files so it's almost identical to the Testing project. But it just doesn't work!?!?!
  4. Olga Romero 2012-09-26

    Executed all 3 attached .js on: Mountain Lion 10.8.1 Xcode 4.5 GM iOS 6.0 for iPad 3 Titanium Studio, build: 2.1.2.201208301612 SDK: 2.1.3.v20120925173111 Test code worked as expected. Added photos to the simulator's gallery, so it is not empty. The simulator privacy setting for photos did not contain a request from my test app for access to photos. As a result apps do not appear in privacy settings. On device, test code worked as expected. The result is identical to Eric's.
  5. Ingo Muschenetz 2012-09-26

    Hi Fokke, We've been unable to reproduce this issue after trying multiple times. If you continue to experience it, or find other examples that cause it, please let us know. Best, Ingo
  6. Javier Perrera 2012-10-08

    Hi I am still running into this issue. It all works ok as described and in the examples above (with an alert) but my issue is that i cannot have an alert box show up everytime I need the user to open the photo gallery. This could be up to 20 times within the app so i need a way of showing it without an alert box. Is there a reason or explanation in why the alert box must be present? And is there anyway of getting around it? I am running: Titanium SDK version: 2.1.3 (10/02/12 16:16 15997d0) iPhone Device family: ipad iPhone SDK version: 6.0 iPhone simulated device: ipad Minimum iOS version: 4.3 Linked iOS Version 6.0 XCode Version 4.5.1 (4G1004)
  7. Javier Perrera 2012-10-08

    So this is the app.js (the attached app_no_alert.js) file exactly as it is in the example, with the only change (bar changing the window orientation) being the alert on the openPhotoGallery event being commented out. This makes the code no longer work
  8. Natalie Huynh 2012-10-10

    Tested with iPad Simulator iOS 6, without the alert, the app hangs and does not open the gallery. Tested with 2.1.3.GA and 3.0.0v20121009111437
  9. Olga Romero 2012-10-10

    Tested "app_no_alert.js" with iPad3 ios 6.0 with: Titanium Studio, build: 3.0.0.201210090117 Titanium SDK, build: 2.1.3.GA and 3.0.0v20121009111437 No alert,app hangs, same behavior, as described by Natalie
  10. Sabil Rahim 2012-10-11

    PhotoGallery(UIImagePickerController) is a portrait-only view controller and in iOS 6 Apple has started enforcing this rule. Short version being Landscape-only applications that invoke a portrait-only view controller (such as the Game Center sign-in screen or the UIImagePickerController) and are built using the iOS 6 SDK may crash/freeze up the UI. The crash log may look like "*** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES'" The interm solution, while Apple may fix this in the future release is to temporarily make container window in which the photogallery popover is to be attached to have a portrait orientation also included in them.
        win.orientationModes= [Titanium.UI.PORTRAIT,Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
        
    Complete code sample with for testing:
        var win = Ti.UI.createWindow({orientationModes: [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT]});//
        
        var otherButton = Ti.UI.createButton({
        	top: 100,
        	title: 'click me later'
        });
        
        var openButton = Ti.UI.createButton({
        	top: 300,
        	title: 'openPhotoGallery'
        });
        
        otherButton.addEventListener('click', function () {
        	alert('You should not see this if the bug report is correct');
        });
        
        openButton.addEventListener('click', function () {
        	//alert('I will now call Ti.Media.openPhotoGallery');
        	win.orientationModes= [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT,Titanium.UI.PORTRAIT];
        	
        	Ti.Media.openPhotoGallery({
        		success:function(event)
        		{
        			win.orientationModes= [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
        	
        		},
        		cancel:function()
        		{
        			win.orientationModes= [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
        	
        		},
        		error:function(error)
        		{
        			win.orientationModes= [Titanium.UI.LANDSCAPE_LEFT, Titanium.UI.LANDSCAPE_RIGHT];
        	
        		},
        		popoverView:openButton,
        	});
        });
        
        win.add(otherButton);
        win.add(openButton);
        
        win.open();
        
    The reason why the bug does not occur when alert dialog is shown, is because of the fact that when a alert dialog is shown we no longer have the keyWindow of the Application that we control and this new window has all Orientation support on it. Marking ticket as not our bug.
  11. Sabil Rahim 2012-10-11

    See apple documentation for more info : http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
  12. Brad Weber 2013-02-03

    This appears to no longer be an issue in iOS 6.1. I created a simple iPad app that only supports landscape orientation and am able to open the photo gallery without blocking.

JSON Source