Ios Deeplinking issue
Closed this issue · 2 comments
ShashankSMayya commented
I tried to follow the guide on enabling clevertap to handle deeplinks for ios this is my appdelegate code.
But wehen I try to run the app I get this error.
Swift Compiler Error (Xcode): Argument type 'AppDelegate' does not conform to expected type 'CleverTapURLDelegate'
/Users/shashanksmayya/IdeaProjects/mello/ios/Runner/AppDelegate.swift:19:47
Swift Compiler Error (Xcode): Non-'@objc' method 'shouldHandleCleverTap(_:for:)' does not satisfy requirement of '@objc' protocol 'CleverTapURLDelegate'
/Users/shashanksmayya/IdeaProjects/mello/ios/Runner/AppDelegate.swift:35:13
import UIKit
import Flutter
import GoogleMaps
import CleverTapSDK
import clevertap_plugin
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
CleverTap.autoIntegrate()
registerForPush()
CleverTapPlugin.sharedInstance()?.applicationDidLaunch(options: launchOptions)
CleverTap.sharedInstance()?.setUrlDelegate(self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func registerForPush() {
UNUserNotificationCenter.current().delegate = self
}
override func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
completionHandler([.sound, .alert, .badge])
}
public func shouldHandleCleverTap(_ url: URL?, for channel: CleverTapChannel) -> Bool {
// print("Handling URL: \(url!) for channel: \(channel)")
return true
}
}
nishant-clevertap commented
As I can see your class does not conforms to CleverTapURLDelegate
, you are getting this error. Make sure your class conforms to this protocol in order to use shouldHandleCleverTap
method like -
@objc class AppDelegate: FlutterAppDelegate, CleverTapURLDelegate {
}
ShashankSMayya commented
Hey @nishant-clevertap Thanks for the help. Its sorted out now :)