-
Notifications
You must be signed in to change notification settings - Fork 66
Deeplink In App Custom HTML Not Working Since 7.2.0 #490
Description
Describe the bug
We are using CleverTap SDK version 7.3.3, upgrading from version 6.1.0. We noticed that starting with version 7.2.0, there were changes related to cleanupWebViewResources (see release notes).
Core Issue: The cleanupWebViewResources function sets the WKWebView navigation delegate to nil, which breaks deeplink functionality in In-App Native Display campaigns.
To Reproduce
Steps to reproduce the behaviour:
- Go to Clevertap Dashboard
- Create some campaign with In App Native Display, attach some deeplink
<a href="https://sample.com/sample-deeplink" - Trigger the campaign
- Observe that deeplinks do not work properly
The issue occurs in the cleanupWebViewResources function within the CTInAppHTMLViewController class:
- (void)cleanupWebViewResources {
if (webView) {
webView.navigationDelegate = nil;
[webView.configuration.userContentController removeScriptMessageHandlerForName:@"clevertap"];
if (_panGesture) {
[webView removeGestureRecognizer:_panGesture];
_panGesture.delegate = nil;
_panGesture = nil;
}
[webView removeFromSuperview];
webView = nil;
}
_jsInterface = nil;
}Problem: When cleanupWebViewResources is executed, it sets webView.navigationDelegate = nil. This prevents the WKWebView from properly handling navigation events, including deeplink redirects. As a result, when users tap on deeplinks within the In-App display, the navigation is not processed correctly.
Expected behaviour
The navigation delegate should remain functional until the webview is completely dismissed to ensure deeplinks continue to work throughout the In-App display lifecycle.
Screenshots
Environment (please complete the following information):
- Xcode version: 16.4
- CleverTap SDK Version: 7.3.3
- Device: iPhone 11
- OS: iOS 18.4.1
Possible Solution
Suggest a fix: keep the navigation delegate active until the webview is removed from the view hierarchy.
Additional context
This issue was introduced in version 7.2.0 and affects deeplink functionality across all subsequent versions, including the current 7.3.4 release.