Skip to content

promises not working in IOS 10 #58

@ZeroZeroOne-dev

Description

@ZeroZeroOne-dev

Im trying to update our application to be iOS 10 compatible (swift 2.3 for now, XWebView version 0.10.0).

Calls to methods in a XWVScripting class that use promises do not get fired.
Example:

XWVScripting class:

class Bridge : NSObject, XWVScripting{
    func getData(promiseObject promise: XWVScriptObject){
        promise.callMethod("resolve", withArguments: ["hello"], completionHandler: nil);
    }

    class func scriptNameForSelector(selector: Selector) -> String? {
        if(selector.description == "getDataWithPromiseObject:"){
            return "getData";
        }

        return nil;
    }
}

Webpage:

<html>
    <head>
        <meta name='viewport' content='width=device-width' />
        <script type="text/javascript">
            var writeLine = function(line) {
                var divCont = document.getElementById("testDiv");
                divCont.innerHTML += line + "<br/>";
            }

            var run = function(){
                bridge.getData().then(function(result){
                    writeLine(result);
                });
            };
        </script>
    </head>
    <body>
        <br />
        <input type="button" value="GO" onclick="run()" />
        <br />
        <div id="testDiv"></div>
    </body>
</html>

The application works fine in iOS 9, but not in iOS 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions