내 아이디어는 내 앱의 비즈니스 로직에 Phonegap을 사용하지만 기본 전환을 사용하는 것입니다. 그래서 모든 UIViewController CDVWebView가 필요합니다. 이 정상적으로 UIWebviews 함께 잘 작동하지만 여러 CDVViewControllers 사용하는 경우 예를 들어. TabBar 일 경우 deviceReady 이벤트는 첫 번째 CDVWebView에 대해서만 실행됩니다. 여기여러 CDVViewController가있는 Phonegap/Cordova
내가 앱 위임에서 할 것입니다 :
- (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;
}
이것은 내가 처음을 제외하고 각각의 ViewController 얻을 오류입니다.
Error: executing module function 'setInfo' in module 'cordova/plugin/ios/device'. Have you included the iOS version of the cordova-1.9.0.js
물론
ERROR: Attempting to call cordova.exec() before 'deviceready'. Ignoring.
은 내가 코르도바가 여러 WebViews을 사용하도록 설계되지 않은 생각, 내 HTML 파일에 코르도바 - 1.9.0을 참조하지만 아무도 변경하는 방법을 알고 있나요 이?
나는 이것이 Cordova의 버그이며 해당 이슈 트래커에 다음과 같이보고했습니다 : https://issues.apache.org/jira/browse/CB-2271 –