Menu

Connect Native App & H5

   In certain scenarios, it is common to integrate H5 (HTML5) pages within a mobile app to achieve fast deployment and updates. However, due to technical limitations, the mobile app is unable to directly access and track event data occurring on the H5 page. To ensure data consistency between the mobile app and the H5 page, the SE SDK enables the data connection function.

API Introduction

  • Parameter webView: WKWebView of system callback
  • Parameter request: navigationAction.request of system callback
- (BOOL)showUpWebView:(WKWebView *)webView withRequest:(NSURLRequest *)request ;

   When initializing WKWebview, you need to set the delegate of WKWebview. When receiving the system callback of WKWebview, webView:decidePolicyForNavigationAction:, you need to call the Webview processing method of SE iOS SDK.

Sample Code

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
    // Call iOS SESDK,SE iOS SDK HTTP header fields:sesdk://
   if ([[SolarEngineSDK sharedInstance] showUpWebView:webView withRequest:navigationAction.request]) {
          decisionHandler(WKNavigationActionPolicyCancel);
          return;
    }
    
   // Developer logic
   decisionHandler(WKNavigationActionPolicyAllow);
}


Previous
Event Report Timing
Next
iOS ATT Authorization
Last modified: 2024-05-27Powered by