Hi,

We support cordova 
plugins<https://crosswalk-project.org/documentation/ios/cordova_plugin_support.html>
 but don’t support cordova plugin add cordova-plugin-crosswak-webview for iOS 
platform, please follow https://crosswalk-project.org/documentation/ios.html to 
create Crosswalk for iOS apps and add Cordova Plugin APIs.

BR
Belem

From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of rejeb 
zorgani
Sent: Monday, May 30, 2016 4:01 AM
To: [email protected]
Subject: [Crosswalk-help] please help : crosswalk webview IOS

Hello,
any person arrive to add crosswalk webview in ios with objective c ?
for a while I try but without results.

all my steps

cordova create PocIOS com.xyz.pocios PocIOS
cordova platform add android
cordova platform add ios
cordova plugin add cordova-plugin-crosswak-webview

I add some lines inside MainViewController.h

#import <WebKit/WebKit.h>
#import <UIKit/UIKit.h>


@interface MainViewController : CDVViewController <WKScriptMessageHandler, 
WKScriptMessageHandler, WKNavigationDelegate, WKUIDelegate> {
    IBOutlet WKWebView *myWebview;
}

I add some other lines inside MainViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.

    WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] 
init];

    WKUserContentController *controller = [[WKUserContentController alloc] 
init];
    [controller addScriptMessageHandler:self name:@"IosPoc"];
    theConfiguration.userContentController = controller;

    //WKWebView *myWebview = [[WKWebView alloc] initWithFrame:self.view.bounds 
configuration:theConfiguration];

    NSURL *myURL = [NSURL URLWithString:@"https://www.google.com/";];
    NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
    [myWebview loadRequest:myRequest];
    [self.view addSubview:myWebview];

}

-(void)webView:(WKWebView *)webView didStartProvisionalNavigation: 
(WKNavigation *)navigation {

}

- (void)webView:(WKWebView *)webView didFinishNavigation: (WKNavigation 
*)navigation{

}

-(void)webView:(WKWebView *)webView didFailNavigation: (WKNavigation 
*)navigation withError:(NSError *)error {

}

- (void)userContentController:(WKUserContentController *)userContentController
      didReceiveScriptMessage:(WKScriptMessage *)message {
    NSDictionary *sentData = (NSDictionary *)message.body;
    NSString *messageString = sentData[@"message"];
    NSLog(@"Message received: %@", messageString);
}

For information, I don't have error message or something, everything is ok.

Then I build my project

cordova build ios

navigator.userAgent
"Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) AppleWebKit/601.1.46 
(KHTML, like Gecko) Mobile/13E230 (140227893095872)"

any help ?

thanks in advance


_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to