如何在IBM Worklight上使用URL Scheme打开iOS Native Page?

时间:2021-09-26 22:10:12

I need to detect a URL Scheme call and if this call happen I need to start a native page.

我需要检测URL Scheme调用,如果发生此调用,我需要启动本机页面。

By now, I've managed to build the URL scheme detection but how can I load my view and not IBM Worklight webview?

到目前为止,我已经设法构建了URL方案检测,但是如何加载我的视图而不是IBM Worklight webview?

In the AppDelegate implementation I have these methods:

在AppDelegate实现中,我有以下方法:

    // This method is called after the WL web framework initialization is complete and web resources are ready to be used.

-(void)wlInitWebFrameworkDidCompleteWithResult (WLWebFrameworkInitResult *)result {
    if ([result statusCode] == WLWebFrameworkInitResultSuccess) {
        [self wlInitDidCompleteSuccessfully]; //declared below
    } else {
        [self wlInitDidFailWithResult:result];
    }
}

-(void)wlInitDidCompleteSuccessfully {
    UIViewController* rootViewController = self.window.rootViewController;

    // Create a Cordova View Controller
    CDVViewController* cordovaViewController = [[CDVViewController alloc] init] ;

    cordovaViewController.startPage = [[WL sharedInstance] mainHtmlFilePath];
    cordovaViewController.webView.scrollView.bounces = YES;

    // Adjust the Cordova view controller view frame to match its parent view bounds
    cordovaViewController.view.frame = rootViewController.view.bounds;

    // Display the Cordova view
    [rootViewController addChildViewController:cordovaViewController];
    [rootViewController.view addSubview:cordovaViewController.view];
}

My idea is conditionate the call of this method with my other method, but the problem is that the handleOpenURL method is called after wlInitWebFrameworkDidCompleteWithResult's call.

我的想法是使用我的其他方法调用此方法,但问题是在wlInitWebFrameworkDidCompleteWithResult的调用之后调用handleOpenURL方法。

Someone can help me?

有人可以帮帮我吗?

1 个解决方案

#1


0  

You should review the following tutorial, which explains how you can "take control" over the startup flow of a Hybrid application. The tutorial is adjusted for MobileFirst apps, and you're using Worklight (an older release of MobileFirst) so you may need to further adjust it for your specific application implementation in the viewcontroller: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/adding-native-functionality/ios-adding-native-ui-elements-hybrid-applications/

您应该查看以下教程,该教程解释了如何“控制”混合应用程序的启动流程。本教程针对MobileFirst应用程序进行了调整,您正在使用Worklight(MobileFirst的旧版本),因此您可能需要在viewcontroller中针对特定应用程序实现进一步调整它:https://developer.ibm.com/mobilefirstplatform/文档/工具入门-7-1 /基础/添加原生的功能/ IOS-加入原生的UI元素混合动力的应用程序/

#1


0  

You should review the following tutorial, which explains how you can "take control" over the startup flow of a Hybrid application. The tutorial is adjusted for MobileFirst apps, and you're using Worklight (an older release of MobileFirst) so you may need to further adjust it for your specific application implementation in the viewcontroller: https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/adding-native-functionality/ios-adding-native-ui-elements-hybrid-applications/

您应该查看以下教程,该教程解释了如何“控制”混合应用程序的启动流程。本教程针对MobileFirst应用程序进行了调整,您正在使用Worklight(MobileFirst的旧版本),因此您可能需要在viewcontroller中针对特定应用程序实现进一步调整它:https://developer.ibm.com/mobilefirstplatform/文档/工具入门-7-1 /基础/添加原生的功能/ IOS-加入原生的UI元素混合动力的应用程序/