Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-2271

Creating multiple CDVViewControllers at once only fires deviceready once

VotersWatch issueWatchersLinkUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.0
    • cordova-ios
    • None
    • Reproducible on iPad/iPhone 5.0 and 6.0 simulator

    Description

      Steps taken to reproduce:

      1. Create custom container view controller
      2. In viewDidLoad add two CDVViewControllers as childViewControllers and hook up view hierarchy appropriately
      3. deviceready will fire for startPage on the first CDVViewController but not for the second

      Workaround:

      Add the second CDVViewController after some delay (e.g. 1 second)

      Image:

      http://localhostr.com/9JszfWk9b7Pa

      More info:

      After some investigation, the problem seems to be a manifestation of a race condition where the address of the CDVViewController passes in the user-agent is clobbered. This means sometimes one CDVViewController will get deviceready and at other times the other one will (but never both).

      I believe this is another case where someone has reproduced this bug:
      http://stackoverflow.com/questions/13082330/phonegap-cordova-with-multiple-cdvviewcontroller

      Attachments (minimal example reproducing bug and workaround):

      http://localhostr.com/5x4AsO1oFonU

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            agrieve Andrew Grieve
            mike kwan Mike Kwan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment