AJAX Plugin broken when exporting to Cordova with WKWebView?

0 favourites
  • 7 posts
From the Asset Store
Cordova device Info mobile and browser modules detect-gpu
  • Problem Description

    The AJAX Plugin seems to be broken when exporting to Cordova with WKWebView. I tried downloading a local resource -- an XML file -- to parse.

    On desktop and when exporting to Cordova with WKWebView disabled this works fine.

    When I enable WKWebView and use the following cordova plugins:

    • cordova-plugin-wkwebview-engine
    • cordova-plugin-httpd

    This fails when I test on iOS. It triggers the AJAX error trigger but I don't know what the error is.

    Attach a Capx

    https://www.dropbox.com/s/f1wajoyprb9kq ... .capx?dl=1

    Description of Capx

    Attempts to download a local resource (an XML) via the AJAX plugin and then parse the output via the XML plugin.

    Steps to Reproduce Bug

    • Open the project.
    • Export to Cordova. Be sure to tick 'Use WKWebView'
    • Build and run the app for iOS.
    • Note that the XML fails to parse and instead the AJAX error trigger is triggered.

    Observed Result

    The AJAX fails to load and instead the AJAX error trigger is triggered.

    Expected Result

    The AJAX call should succeed and the XML data should be parsed by the XML plugin.

    Affected Browsers

    • Chrome: (NO)
    • iOS Cordova (YES)

    Operating System and Service Pack

    iOS 9.3

    Construct 2 Version ID

    Release 228

  • You also need cordova-plugin-file in WKWebView mode. How exactly are you building? Is there a reason you excluded it? Construct 2 should specify it automatically when exporting for Cordova.

  • Hi Ashley,

    I actually do have cordova-plugin-file installed as well sorry. I was only listing the plugins I thought were necessary.

    In reality I have a few plugins installed:

    • cordova-admob-sdklibs
    • cordova-libgoogleadmobads
    • cordova-plugin-ad-adcolony
    • cordova-plugin-ad-unityads
    • cordova-plugin-ad-unityads-sdk
    • cordova-plugin-admob-simple
    • cordova-plugin-compat
    • cordova-plugin-file
    • cordova-plugin-game-center
    • cordova-plugin-httpd
    • cordova-plugin-inappbrowser
    • cordova-plugin-inapppurchase
    • cordova-plugin-media
    • cordova-plugin-nativeaudio
    • cordova-plugin-whitelist
    • cordova-plugin-wkwebview-engine
    • cordova-plugin-x-socialsharing

    In my cordova config.xml I have these tags:

    <plugin name="cordova-plugin-whitelist" spec="1" />

    <plugin name="cordova-plugin-game-center" spec="1" />

    <plugin name="cordova-plugin-inapppurchase" spec="1" />

    Most of the time I don't seem to need to add plugins to this config file otherwise.

    To build I just do:

    cordova build

    And then I open via Xcode and compile etc.

    I've tested my setup with the exact same .capx and done exports with wkwebview enabled and disabled. When it's enabled I get the AJAX failure, when it's disabled the AJAX works fine.

  • Thanks, should be fixed in the next beta. Good catch.

  • Hello!

    C2 release 227 |233, Intel XDK 3400 | 3522, exporting to iOS

    With WKWebView AJAX not working.

  • SparklingAir - please file a new bug following all the guidelines, this report was fixed and subsequently closed.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • ok

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)