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

[iOS 8] cordova-plugin-wkwebview-engine breaks Cordova iOS 4.0.0 under iOS 8

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.0.0
    • Fix Version/s: None
    • Environment:

      Cordova tools 5.4.1
      Cordova iOS platform 4.0.1
      iOS Simulator 8.4
      cordova-plugin-wkwebview-engine plugin

      Description

      When launching on iOS 8.4 simulator the following error breaks JS execution early on:
      ios-wkwebview-exec.js:127 TypeError: undefined is not an object (evaluating 'window.webkit.messageHandlers')

      So inclusion of 'cordova-plugin-wkwebview-engine' plugin breaks support of iOS versions previous to 9.0. I assume ios-wkwebview-exec.js should have environment checks before using WKWebView bridge...

      Exclusion of the same plugin breaks the project at all. Are there any fallback mechanics in place?

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jamesandersen closed the pull request at:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3

          Show
          githubbot ASF GitHub Bot added a comment - Github user jamesandersen closed the pull request at: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user shazron commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-194040883

          @jamesandersen can you close this? it came out in the 1.0.2 release of the plugin

          Show
          githubbot ASF GitHub Bot added a comment - Github user shazron commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-194040883 @jamesandersen can you close this? it came out in the 1.0.2 release of the plugin
          Hide
          shazron Shazron Abdullah added a comment - - edited

          No, incorrect. The Apache release process requires a voting and verification period. In total, it may take up to a week, minimum 48 hrs. Do yourself a favor and not wait for it.

          Show
          shazron Shazron Abdullah added a comment - - edited No, incorrect. The Apache release process requires a voting and verification period. In total, it may take up to a week, minimum 48 hrs. Do yourself a favor and not wait for it.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user dpogue commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180132192

          This is part of an Apache Software Froundation project, so any release needs to follow the ASF guidelines including a 48-hour voting period with 3 votes of approval on the mailing list.

          Show
          githubbot ASF GitHub Bot added a comment - Github user dpogue commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180132192 This is part of an Apache Software Froundation project, so any release needs to follow the ASF guidelines including a 48-hour voting period with 3 votes of approval on the mailing list.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user hassankhan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180128975

          True, but a new release is usually only an `npm publish` away, unless I'm mistaken?

          Show
          githubbot ASF GitHub Bot added a comment - Github user hassankhan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180128975 True, but a new release is usually only an `npm publish` away, unless I'm mistaken?
          Hide
          shazron Shazron Abdullah added a comment -

          I just outlined how to install from Github. Cordova has multiple ways to install things. The Apache process does take time.

          Show
          shazron Shazron Abdullah added a comment - I just outlined how to install from Github. Cordova has multiple ways to install things. The Apache process does take time.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jcesarmobile commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180077007

          It's not on NPM yet, plugin releases take time.
          Anybody using cordova can install from github, they don't have to wait for the NPM release.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jcesarmobile commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180077007 It's not on NPM yet, plugin releases take time. Anybody using cordova can install from github, they don't have to wait for the NPM release.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user IvanKarpan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180050118

          IMHO without a release to npm this whole WKWebView support of Cordova is pretty not usable at all ATM...

          Show
          githubbot ASF GitHub Bot added a comment - Github user IvanKarpan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-180050118 IMHO without a release to npm this whole WKWebView support of Cordova is pretty not usable at all ATM...
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user hassankhan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179944762

          I believe it is merged just fine, but there hasn't been a new release of the plugin on npm, so anybody trying to use the latest version won't get this fix at the moment.

          Show
          githubbot ASF GitHub Bot added a comment - Github user hassankhan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179944762 I believe it is merged just fine, but there hasn't been a new release of the plugin on npm, so anybody trying to use the latest version won't get this fix at the moment.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user jcesarmobile commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179891115

          check the jira issue
          https://issues.apache.org/jira/browse/CB-10269
          Commit faa9d877045d8baf8afdfd0d8689389ec240e2e4 in cordova-plugin-wkwebview-engine's branch refs/heads/master from James Andersen
          [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=faa9d87 ]

          Or check the main page https://github.com/apache/cordova-plugin-wkwebview-engine, you can see.
          jamesandersen committed with shazron CB-10269: Replace cordova exec only when present in wkwebview

          It should have closed this, but sometimes fails.

          Show
          githubbot ASF GitHub Bot added a comment - Github user jcesarmobile commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179891115 check the jira issue https://issues.apache.org/jira/browse/CB-10269 Commit faa9d877045d8baf8afdfd0d8689389ec240e2e4 in cordova-plugin-wkwebview-engine's branch refs/heads/master from James Andersen [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=faa9d87 ] Or check the main page https://github.com/apache/cordova-plugin-wkwebview-engine , you can see. jamesandersen committed with shazron CB-10269 : Replace cordova exec only when present in wkwebview It should have closed this, but sometimes fails.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user andres-torres-marroquin commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179887523

          I also thought it wasn't merged, how can we know that? I'm unfamiliar on how this is handled.

          Show
          githubbot ASF GitHub Bot added a comment - Github user andres-torres-marroquin commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179887523 I also thought it wasn't merged, how can we know that? I'm unfamiliar on how this is handled.
          Hide
          shazron Shazron Abdullah added a comment -

          Eventually.
          For now you can just:

          cordova plugin add https://github.com/apache/cordova-plugin-wkwebview-engine.git#master
          

          Replace master in #master with a commit SHA etc, branch, but since its in master you're fine for now

          Show
          shazron Shazron Abdullah added a comment - Eventually. For now you can just: cordova plugin add https: //github.com/apache/cordova-plugin-wkwebview-engine.git#master Replace master in #master with a commit SHA etc, branch, but since its in master you're fine for now
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user hassankhan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179556132

          Is it possible for a new release to be tagged?

          Show
          githubbot ASF GitHub Bot added a comment - Github user hassankhan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179556132 Is it possible for a new release to be tagged?
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user hassankhan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179555817

          Ah my mistake, I assumed the error I was getting was related to this.

          Show
          githubbot ASF GitHub Bot added a comment - Github user hassankhan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179555817 Ah my mistake, I assumed the error I was getting was related to this.
          Show
          githubbot ASF GitHub Bot added a comment - Github user dpogue commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179554784 It has already been merged in https://github.com/apache/cordova-plugin-wkwebview-engine/commit/faa9d877045d8baf8afdfd0d8689389ec240e2e4
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user hassankhan commented on the pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179554625

          +1 can this be merged soon please? :+1:

          Show
          githubbot ASF GitHub Bot added a comment - Github user hassankhan commented on the pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3#issuecomment-179554625 +1 can this be merged soon please? :+1:
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit faa9d877045d8baf8afdfd0d8689389ec240e2e4 in cordova-plugin-wkwebview-engine's branch refs/heads/master from James Andersen
          [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=faa9d87 ]

          CB-10269: Replace cordova exec only when present in wkwebview

          Show
          jira-bot ASF subversion and git services added a comment - Commit faa9d877045d8baf8afdfd0d8689389ec240e2e4 in cordova-plugin-wkwebview-engine's branch refs/heads/master from James Andersen [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-wkwebview-engine.git;h=faa9d87 ] CB-10269 : Replace cordova exec only when present in wkwebview
          Hide
          jcesarmobile jcesarmobile added a comment -

          Tested James Andersen version and worked fine for me

          Show
          jcesarmobile jcesarmobile added a comment - Tested James Andersen version and worked fine for me
          Hide
          shazron Shazron Abdullah added a comment -

          Thanks James!
          For those affected, please test by doing a:

          cordova plugin add https://github.com/jamesandersen/cordova-plugin-wkwebview-engine.git
          

          (as long as James doesn't update his master branch – usually you would send a PR from a feature branch, but its ok - maybe next time

          Show
          shazron Shazron Abdullah added a comment - Thanks James! For those affected, please test by doing a: cordova plugin add https: //github.com/jamesandersen/cordova-plugin-wkwebview-engine.git (as long as James doesn't update his master branch – usually you would send a PR from a feature branch, but its ok - maybe next time
          Hide
          jandersen78 James Andersen added a comment - - edited

          I've created a PR: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3 (and sent in my ICLA to apache)

          Show
          jandersen78 James Andersen added a comment - - edited I've created a PR: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3 (and sent in my ICLA to apache)
          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user jamesandersen opened a pull request:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3

          CB-10269: Replace cordova exec only when present in wkwebview

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/jamesandersen/cordova-plugin-wkwebview-engine master

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #3


          commit 66d70fed2454b1af164214a06a91cbeec7065cb0
          Author: James Andersen <james.andersen@universalmind.com>
          Date: 2016-01-15T02:02:42Z

          CB-10269: Replace cordova exec only when present in wkwebview


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user jamesandersen opened a pull request: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3 CB-10269 : Replace cordova exec only when present in wkwebview You can merge this pull request into a Git repository by running: $ git pull https://github.com/jamesandersen/cordova-plugin-wkwebview-engine master Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-wkwebview-engine/pull/3.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3 commit 66d70fed2454b1af164214a06a91cbeec7065cb0 Author: James Andersen <james.andersen@universalmind.com> Date: 2016-01-15T02:02:42Z CB-10269 : Replace cordova exec only when present in wkwebview
          Hide
          IvanKarpan Ivan Karpan added a comment -

          Not yet... I could do it with James Andersen's solution, although it would be more correct if he did it himself I guess.

          Show
          IvanKarpan Ivan Karpan added a comment - Not yet... I could do it with James Andersen's solution, although it would be more correct if he did it himself I guess.
          Hide
          nikhilkh Nikhil Khandelwal added a comment -

          Is there a PR for this issue?

          Show
          nikhilkh Nikhil Khandelwal added a comment - Is there a PR for this issue?
          Hide
          shazron Shazron Abdullah added a comment -

          Thanks! This was the change I was going to propose as well.

          Show
          shazron Shazron Abdullah added a comment - Thanks! This was the change I was going to propose as well.
          Hide
          jandersen78 James Andersen added a comment -

          I've had some success working around this issue by adding this modified ios-wkwebview-exec.js to merges/ios/plugins/cordova-plugin-wkwebview-engine/src/www/ios so that it replaces the one that currently ships with the plugin. The only modification I've made is to check for the WKWebView before replacing the "cordova/exec" module:

          // Temporary work around for https://issues.apache.org/jira/browse/CB-10269 until it is fixed
             if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) {
                // unregister the old bridge
                cordova.define.remove('cordova/exec');
                // redefine bridge to our new bridge
                cordova.define("cordova/exec", function (require, exports, module) {
                   module.exports = execProxy;
                });
             }
          
          Show
          jandersen78 James Andersen added a comment - I've had some success working around this issue by adding this modified ios-wkwebview-exec.js to merges/ios/plugins/cordova-plugin-wkwebview-engine/src/www/ios so that it replaces the one that currently ships with the plugin. The only modification I've made is to check for the WKWebView before replacing the "cordova/exec" module: // Temporary work around for https://issues.apache.org/jira/browse/CB-10269 until it is fixed if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova && window.webkit.messageHandlers.cordova.postMessage) { // unregister the old bridge cordova.define.remove('cordova/exec'); // redefine bridge to our new bridge cordova.define( "cordova/exec" , function (require, exports, module) { module.exports = execProxy; }); }
          Hide
          adrianflorinflorescu Adrian Florin Florescu added a comment - - edited

          I get the same error on iOS 8.3, but on iOS9 works fine. Any thoughts on how we can fix this anybody?

          I created an issue too, any way to merge both? https://issues.apache.org/jira/browse/CB-10297

          Show
          adrianflorinflorescu Adrian Florin Florescu added a comment - - edited I get the same error on iOS 8.3, but on iOS9 works fine. Any thoughts on how we can fix this anybody? I created an issue too, any way to merge both? https://issues.apache.org/jira/browse/CB-10297
          Hide
          shazron Shazron Abdullah added a comment -

          The plugin falls back to UIWebView under iOS 8, in the native code. It looks like bridge JS (which wasn't broken when all the bridge code was in one JavaScript file) breaks when it is put into the plugin. cc Jesse MacFadyen

          Show
          shazron Shazron Abdullah added a comment - The plugin falls back to UIWebView under iOS 8, in the native code. It looks like bridge JS (which wasn't broken when all the bridge code was in one JavaScript file) breaks when it is put into the plugin. cc Jesse MacFadyen

            People

            • Assignee:
              shazron Shazron Abdullah
              Reporter:
              IvanKarpan Ivan Karpan
            • Votes:
              4 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development