Custom plugin is not displayed


#1

Hi all!

I created a WKWebView plugin for iOS, but it does not displays in the application. No error throws. In the log all messages (such as ‘onLoaded’, ‘Success’, etc) normally displayed.

I don’t understand what’s wrong here. Please, help.


#2

Wish I knew iOS enough and the NS core for iOS View plugins and I could be useful. Sorry. Your code looks good though :slight_smile:


#3

Native code has no notion of the “~/” path, so you need to convert it to a real file path. How about this?

// import
const utils = require("utils/utils");
const fs = require("file-system");

// instead of your current 'loadUrl' function:
if (url.indexOf("~/") === 0) {
  url = fs.path.join(fs.knownFolders.currentApp().path, url.replace("~/", ""));
}

let myURL = NSURL.fileURLWithPath(url);
this._ios.loadFileURLAllowingReadAccessToURL(myURL, myURL);

#4

Thanks Eddy, is works :slight_smile: