Telephone / Cordoba with multiple CDVViewController

My idea is to use Phonegap for the business logic of my application, but use my own transitions. Therefore, I need a CDVWebView in every UIViewController. This works fine with regular UIWebviews, but if I use multiple CDVViewControllers, for example. TabBar, the deviceReady event is fired only for the first CDVWebView.

Here is what I do in the App Delegate:

- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; NSString* invokeString = nil; if (url && [url isKindOfClass:[NSURL class]]) { invokeString = [url absoluteString]; NSLog(@"NativeNavigationTest launchOptions = %@", url); } NSLog(@"invokeString = %@", invokeString); CGRect screenBounds = [[UIScreen mainScreen] bounds]; self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; self.window.autoresizesSubviews = YES; CGRect viewBounds = [[UIScreen mainScreen] applicationFrame]; //4 ViewController, each one inherits from CDVViewController self.viewController = [[[MainViewController alloc] init] autorelease]; self.viewController.useSplashScreen = YES; self.viewController.wwwFolderName = @"www"; self.viewController.startPage = @"index.html"; self.viewController.invokeString = invokeString; self.viewController.view.frame = viewBounds; self.secondController = [[[SecondController alloc] init] autorelease]; self.secondController.useSplashScreen = YES; self.secondController.wwwFolderName = @"www"; self.secondController.startPage = @"second.html"; self.secondController.invokeString = invokeString; self.secondController.view.frame = viewBounds; self.thirdController = [[[ThirdController alloc] init] autorelease]; self.thirdController.useSplashScreen = YES; self.thirdController.wwwFolderName = @"www"; self.thirdController.startPage = @"third.html"; self.thirdController.invokeString = invokeString; self.thirdController.view.frame = viewBounds; self.fourthController = [[[FourthController alloc] init] autorelease]; self.fourthController.useSplashScreen = YES; self.fourthController.wwwFolderName = @"www"; self.fourthController.startPage = @"fourth.html"; self.fourthController.invokeString = invokeString; self.fourthController.view.frame = viewBounds; //add them in a native ViewController environment like a Tabbar self.tabBarController = [[[UITabBarController alloc] init] autorelease]; self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController, secondController, thirdController, fourthController, nil]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; 

}

This is the error I get for every ViewController, except for the first one.

 Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.9.0.js 

and

 ERROR: Attempting to call cordova.exec() before 'deviceready'. Ignoring. 

Of course, I refer to cordova-1.9.0 in my HTML files, I think Cordova was not intended to use multiple WebViews, but does anyone know how to change this?

+4
source share
2 answers

Answer Cordoba WebView . Designed for embedding in native applications.

change

with multiple Cordova webviews, it has the same errors. I don’t know what’s the matter when you can put only one Phonegap-enabled webview in your project.

+1
source

I confirmed this as a condition of the race in Cordoba - the problem is fixed with 2.4.0.

+1
source

Source: https://habr.com/ru/post/1442254/


All Articles