[TIMOB-18140] iOS: AlertDialog: Screen shows old orientation when foregrounding after orientation change in background
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-12-08T18:47:20.000+0000 |
Affected Version/s | Release 3.5.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | alertDialog, background, ios, qe-3.5.0, regression |
Reporter | Eric Wieber |
Assignee | Jon Alter |
Created | 2014-12-04T21:49:21.000+0000 |
Updated | 2017-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
File | Date | Size |
---|---|---|
Orientation change error.gif | 2014-12-04T21:49:21.000+0000 | 3428272 |
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 theforceSplashAsSnapshot
property. Setting this property totrue
will display the app's splash screen on resume. Add the following line to the example above.Closing ticket as the issue will not fix and with reference to the above comments.