Netmera Developer Guide
Netmera Docs
  • Netmera Developer Guide
  • Platforms
    • iOS
      • New iOS (Swift)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Widget and In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Advertising ID
        • Changelog
      • Former iOS (Objective-C)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Push Payload Receivers
          • Widget and In-App Messages
          • Customizing In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
          • Custom Web View Presentation
          • Push Icon
        • Live Activities
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Data Transfer
        • Advertising ID
        • SSL Pinning
        • Changelog
    • Android
      • SDK Integration
        • Huawei Integration
        • Huawei Message Receipt
        • Android Integration FAQs
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
        • Custom Web View Presentation
        • Push Icon
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
        • Background Location Permission
      • User & Attributes
      • Data Transfer
      • Advertising ID
      • App Tracking
      • SSL Pinning
      • Changelog
    • Web
      • SDK Setup
        • Self-Hosted SDK Setup
      • Mobile Web Push for iOS
      • Deep Linking
        • Custom Deep Links
      • Events
      • User & Attributes
    • React Native
      • SDK Integration
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • Changelog
    • Flutter
      • SDK Integration
      • Push Notifications
        • Push Notification Permissions
        • Widget and In-App Messages
        • Flutter iOS Media Push
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • SSL Pinning
      • Changelog
    • Cordova
      • SDK Integration
      • Push Notifications
      • Sound & Vibration
      • Push Inbox
      • Events
      • User & Attributes
    • Unity
      • SDK Integration
      • Sound & Vibration
      • Events
      • User & Attributes
      • Changelog
  • Integrated Modules
    • Optimove
    • Adjust
    • Mixpanel
    • IYS Integration
    • VIA Integration
      • Short URL Consent Requests
      • OTP Consent Requests
        • OTP Confirmation Completion
      • VIA Email Rejection Link Generation
      • ETK Rejection via SMS
  • API Documentation
    • REST API
      • Setup
      • Notifications
      • Events
      • User & Device Management
      • Inbox Feature
      • GDPR
      • Error Responses
  • FAQs
    • Push Notifications FAQs
Powered by GitBook
On this page
  • Step 1: Set the Push Delegate
  • Step 2: Implement the handleWebViewPresentation Method
  • Step 3: Presentation Flow

Was this helpful?

  1. Platforms
  2. iOS
  3. Former iOS (Objective-C)
  4. Push Notifications

Custom Web View Presentation

By default, Netmera handles the presentation of web view content in push or popup notifications automatically. However, if you want to implement your own custom presentation flow, follow these steps:

Step 1: Set the Push Delegate

Ensure your class is set as the push delegate for the Netmera SDK.

Netmera.setPushDelegate(self as! NetmeraPushDelegate)

Step 2: Implement the handleWebViewPresentation Method

In your delegate class, implement the -handleWebViewPresentation: method:

func handleWebViewPresentation(for object: NetmeraPushObject!) {
    let vc = TableViewController()
    let rootVC: UIViewController? = UIApplication.shared.keyWindow?.rootViewController
    rootVC?.present(vc, animated: true, completion: nil)
    // Load web view content inside the presented webView
    Netmera.loadWebViewContent(in: vc.webView)
}

Step 3: Presentation Flow

When a push notification with web view content is received:

  • The SDK checks if a NetmeraPushDelegate object is set.

  • If the delegate exists and implements -handleWebViewPresentation:, it will use your custom flow.

  • If no delegate or method is found, the SDK uses its default presentation flow.

Within the delegate method, call the [Netmera loadWebViewContentInWebView:] method.

The provided code is an example and requires customization for your own web view presentation flow.

import Netmera

class YourClass {
    init() {
        // Make sure you have set your object as the push delegate of Netmera SDK
        Netmera.setPushDelegate(self as! NetmeraPushDelegate)
        return
    }
}

func handleWebViewPresentation(for object: NetmeraPushObject!) {
    let vc = TableViewController()
    let rootVC: UIViewController? = UIApplication.shared.keyWindow?.rootViewController
    rootVC?.present(vc, animated: true) { _ in }
    
    // Load web view content inside the presented webView
    Netmera.loadWebViewContent(in: vc.webView)
}
#import <Netmera/Netmera.h>

@interface YourClass <NetmeraPushDelegate>
@end

@implementation YourClass

- (instancetype)init {
    self = [super init];
    if (self) {
        // Make sure you have set your object as the push delegate of Netmera SDK
        [Netmera setPushDelegate:self];
    }
    return self;
}

- (void)handleWebViewPresentationForPushObject:(NetmeraPushObject *)object {
    // Present your web view UI
    YourWebViewController *vc = [[YourWebViewController alloc] init];
    UIViewController *rootVC = [UIApplication sharedApplication].keyWindow.rootViewController;
    [rootVC presentViewController:vc animated:YES completion:nil];

    // Load web view content inside the presented webView
    [Netmera loadWebViewContentInWebView:vc.webView];
}

@end
PreviousCarousel, Slider and Thumbnail PushNextPush Icon

Last updated 2 months ago

Was this helpful?