cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xingchen Yu (JIRA)" <>
Subject [jira] [Created] (CB-9441) cordova-plugin-dialogs alert does not show on iOS when there's another plugin on top of the UIVIewController
Date Sun, 02 Aug 2015 22:31:04 GMT
Xingchen Yu created CB-9441:

             Summary: cordova-plugin-dialogs alert does not show on iOS when there's another
plugin on top of the UIVIewController
                 Key: CB-9441
             Project: Apache Cordova
          Issue Type: Bug
          Components: iOS, Plugin Dialogs
    Affects Versions: 3.5.0
            Reporter: Xingchen Yu

navigator.notifications.alert / confirm is supposed to display a dialog on top of the app,
however when there's another plugin that's being shown (such as InAppBrwoser or its forks),
navigator.notifications.alert / confirm will do nothing. In Xcode console you can see the
following warning:

Warning: Attempt to present UIAlertController on MainViewController whose view is not in the
window hierarchy

Reproduction step:
1. Install cordova-plugin-dialogs
2. Install cordova-plugin-inappbrowser
3. Create a dummy button that launches InAppBrowser
4. Listen to one of InAppBrowser's events, such as loadstop. Inside the event listener, call
navigator.notification.alert / confirm
5. Build iOS
6. Click dummy button to launch InAppBrowser. Observe that alert does not show up and the
above warning in Xcode console.
7. More conveniently, simply connect to Safari debugger, call navigator.notification.alert
/ confirm in JavaScript console while InAppBrowser is shown. Observe same issue as step 6.

I have already debugged this issue, so please allow me to explain. iOS only allows you to
stack a new UIViewController on top of the top most UiViewController. In case of cordova-plugin-dialogs,
it simply stacks on top of self.viewController, which is the app's default UIViewController.
However when another plugin (think InAppBrowser) that also stacks on top of self.viewController,
now the other plugin is the top most UIViewController, and iOS prevents further UIViewController
to be stacked on self.viewController. Therefore cordova-plugin-dialogs now does nothing but
a warning from Xcode console.

This issue is somewhat related to CB-9347 and its pull request
can mostly fix this issue along with it. However CB-9347 addresses a very different use case,
and it doesn't address a case where a third party plugin may be in the process of dismissing
and navigator.notification.alert / confirm may be called.

I can contribute a pull request, but I'd like to see CB-9347 accepted first, so I can test
it out and take appropriate actions, since CB-9347 is highly related in coding.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message