cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "jcesarmobile (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-12459) network-information and device plugins cause deviceready to not fire on cordova-ios 4+
Date Wed, 15 Feb 2017 23:32:41 GMT

    [ https://issues.apache.org/jira/browse/CB-12459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15868811#comment-15868811
] 

jcesarmobile commented on CB-12459:
-----------------------------------

Have you ever tried what I told you on Slack?

To run javascript in your webview you only have to use 
{code}
[self.commandDelegate evalJs:@"your javascript here"];
{code}

You don't need a reference to the webview, you just have to use that code from a plugin, not
from the MainViewController, you should NEVER edit the Objective-C classes from the Cordova
project, and of course, you should not hijack the delegates, you don't need to do it neither.

If for some reason you still want to get the webview reference when the app finish loading,
looking into the link Shazron told you on Slack you can see this:
https://github.com/apache/cordova-ios/blob/master/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m#L67

The delegate is sending a notification when Cordova finish loading and passing the webview
on it, you can listen for this notification on your plugin class and use the webview (casting
it to UIWebView as it's an UIView now)





> network-information and device plugins cause deviceready to not fire on cordova-ios 4+
> --------------------------------------------------------------------------------------
>
>                 Key: CB-12459
>                 URL: https://issues.apache.org/jira/browse/CB-12459
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Device, Plugin Network Information
>    Affects Versions: cordova-ios@4.3.1
>         Environment: Phonegap cli version 6.4.3, cordova cli 6.5.0, cordova platform
ios 4.3.1
>            Reporter: Mark
>            Assignee: jcesarmobile
>
> installing either of these 2 plugins results in an app deviceready event not firing.
It also results in the didFinishLaunchingWithOptions delegates not firing. 
> I used a bare skeleton of an app, but executing only these commands :
> phonegap create test com.test "Test"
> cd test
> cordova platform add ios
> cordova plugin add cordova-plugin-network-information
> I edit the MainViewController.h file and add the protocol to the declaration :
> MainViewController implements CDVViewController <UIWebViewDelegate>
> I edit MainViewController.m and simply add the method definition :
> - (void)webViewDidFinishLoad:(UIWebView *)webView {
>      
>     [super webViewDidFinishLoad:theWebView];  
> }
> I use XCode (7+) to install the app and run it on any iphone device and the deviceready
event never fires.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message