iOS PhoneGap Plugins stop working after adding CocoonJS iOS WebView+ Plugin

444 Views Asked by At

Like the title says. Adding CocoonJS iOS WebView+ plugin to my Cordova PhoneGap project stops it from loading and running plugins.

I also tried it with an empty project and it also did not work.

Here is how I am adding the CocoonJS plugin:

cocoonjs plugin add com.ludei.ios.webview.plus

I tried it with the following plugins:

com.google.cordova.admob 1.1.1 "AdMob Plugin Pro"
com.ludei.ios.webview.plus 1.0.4 "Webview+"
com.rjfun.cordova.plugin.lowlatencyaudio 1.1.4 "LowLatencyAudio"
nl.x-services.plugins.socialsharing 4.3.7 "SocialSharing"
org.apache.cordova.camera 0.3.2 "Camera"

None of them worked.

For SocialSharing, the initialization function does get called. But none of the other plugin functions are called.

For the rest of the plugins, even the initialization functions are not called.

After comparing a project with WebView+ and without, it seems the place it calls the plugin initializations from is in CordovaLib.xcodeproj/Classes/Cleaver/CDViewController.m, on line 669, it tries to load the plugins by checking if the url scheme is for a PhoneGap app:

(

BOOL)webView:(UIWebView)theWebView shouldStartLoadWithRequest:(NSURLRequest)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSURL* url = [request URL];

    /* Execute any commands queued with cordova.exec() on the JS side.
    The part of the URL after gap:// is irrelevant. */ 
    if ([[url scheme] isEqualToString:@"gap"]) 
    { 
        [commandQueue fetchCommandsFromJs]; // The delegate is called asynchronously in this case, so we don't have to use // flushCommandQueueWithDelayedJs (setTimeout(0)) as we do with hash changes. 
        [commandQueue executePending]; 
        return NO; 
    }
...
}

On my PhoenGap project without CocoonJS, theWebView shouldStartLoadWithRequest gets called 3 times. The last time with @"gap://ready".

It then enters that part of the code and loads all the plugins.

With the CocoonJS, theWebView shouldStartLoadWithRequest only gets called once, and never with the @"gap://ready". So none of the plugins ever get initialized.

On the CocoonJS site they seem to indicate that you can use PhoneGap plugins with WebView+.

Anyone know how to fix this problem?

Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

And here is the official answer: they do not support phonegap plugins.

Hello,

Sorry for the late response, and for the bad news. We are not compatible with PhoneGap Plugins yet. In addition, I don't know if we will in the near future.

Regards.

http://support.ludei.com/hc/communities/public/questions/201575145-iOS-PhoneGap-Plugins-not-loading-after-adding-CocoonJs-plugin