Reputation: 39
I have an ionic react app that uses capacitor.
For firebase dynamic links i used the cordova-plugin-firebase-dynamiclinks. (https://github.com/chemerisuk/cordova-plugin-firebase-dynamiclinks), as it was recommened by ionic, and ran "ionic cap sync".
Everything works well with android , but on ios the OnDynamicLink function is not triggered when app is entered via a dynamic link.
Digging into the code I saw the the functions under the plugin's AppDelegate file (ex:FirebaseDynamicLinks+AppDelegate.swift) are not called, rather the main AppDelegate.swift functions , specifically the following functions:
" application:continueUserActivity:restorationHandler" and "application: UIApplication, open url: URL")
are called instead.
I understood there is method swizzling for dynamic links but it doesnt seem to work. I have spent two days on this issue without success. What could be causing the issue?
UPDATE
After some research I realized that the reason why the method swizzling isn't working, is since the plugin code is in objective-c and the App is is in swift,
so when trying to swizzle the App Delegate functions, the selectors of the functions to swizzle dont match.
So now my updated question is:How to deal with such cases?
I have tried adding the @objc attribute to the App Delegate functions that should be swizzled , with no success .
Upvotes: 4
Views: 2867
Reputation: 1843
You are right about swizzled methods not getting executed. It seems to be caused by Capacitor (the plugin was written for Cordova).
Although not exactly an answer to your question, I suggest using a plugin for Capacitor: https://github.com/Turnoutt/capacitor-firebase-dynamic-links
I tested it today, works both on Android and iOS.
Upvotes: 0