Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18140] iOS: AlertDialog: Screen shows old orientation when foregrounding after orientation change in background

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2014-12-08T18:47:20.000+0000
Affected Version/sRelease 3.5.0
Fix Version/sn/a
ComponentsiOS
LabelsalertDialog, background, ios, qe-3.5.0, regression
ReporterEric Wieber
AssigneeJon Alter
Created2014-12-04T21:49:21.000+0000
Updated2017-03-22T18:09:51.000+0000

Description

An app shows an old screen state when foregrounding after the device's orientation is changed while in the background. Please see attached gif. *Steps to reproduce issue*: 1. Launch the sample code 2. With device in portrait mode, click on the 'Short Title' button 3. Without dismissing the alert, click on the home button to send the app in background. 4. Change the orientation of device to landscape and launch the app again 5. Dismiss the alert 6. Click on the home button to send the app in background. 7. Change the orientation of device to portrait and launch the app again 8. Notice that the first alert is shown for a second *Expected Results*: The first alert is not shown after returning to the app in step 7. *Notes*: This does not occur in SDK 3.4.1.GA.
    _window = Ti.UI.createWindow({
        backgroundColor : '#fff'
    });

var longmsg = "Appcelerator is the only mobile first platform that enables enterprise to create, deliver and analyze their mobile applications. Appcelerator offers the only platform built for a Mobile First world. It is the mobile platform of choice for thousands of companies including eBay, Merck, Mitsubishi Electric, NBC, PayPal and Ray-Ban, as they become Mobile First enterprises. With 59,895 mobile applications deployed on 162,143,002 devices, the Appcelerator Platform helps enterprises accelerate their time to market, reduce costs, manage risk, and deliver exceptional mobile user experiences.";

    var Button1 = Ti.UI.createButton({
        title: "Short Title",
        top: 30
    });

    Button1.addEventListener('click', function(e) {
        shortAlertDialog.show();
    });

    var Button2 = Ti.UI.createButton({
        title: "Long Title",
        top: 80
    });

    Button2.addEventListener('click', function(e) {
        longAlertDialog.show();
    });

    var shortAlertDialog = Ti.UI.createAlertDialog({
        message: 'The file has been deleted',
        ok: 'Okay',
        title: 'Short Dialog',
        persistent: true
    });

    var longAlertDialog = Ti.UI.createAlertDialog({
        message: longmsg,
        ok: "Okay",
        title: "Long Dialog",
        persistent: true

    });

    _window.add(Button1);
    _window.add(Button2);

    _window.open();

Attachments

FileDateSize
Orientation change error.gif2014-12-04T21:49:21.000+00003428272

Comments

  1. Jon Alter 2014-12-08

    This happens because Apple takes a screenshot of your app when it goes into the background and displays that screenshot while the app is resuming. Naturally, the app has a different screenshot for portrait than the one it uses for landscape. The alert dialog being seen is actually the screenshot of the app state when you backgrounded the app in that orientation. This behavior can be observed in a native app by following the same repro steps above but changing the background color instead of using an alert.

    Workaround

    This issue can easily be avoided by using the forceSplashAsSnapshot property. Setting this property to true will display the app's splash screen on resume. Add the following line to the example above.
       Ti.App.forceSplashAsSnapshot = true;
       
  2. Lee Morris 2017-03-22

    Closing ticket as the issue will not fix and with reference to the above comments.

JSON Source