Open faisal3389 opened 7 years ago
@faisal3389 We also had this issue, we fixed it like this:
import * as Application from 'tns-core-modules/application';
if (Application.ios) {
let oldapplicationOpenURLSourceApplicationAnnotation;
if (Application.ios.delegate === undefined) {
// Create new delegate when none is set.
@ObjCClass(UIApplicationDelegate)
class CustomUIApplicationDelegateImpl extends UIResponder implements UIApplicationDelegate {
}
Application.ios.delegate = CustomUIApplicationDelegateImpl;
} else {
// Copy old delegate when already set, so we can call it in our own method.
if (Application.ios.delegate.prototype.applicationOpenURLSourceApplicationAnnotation) {
oldapplicationOpenURLSourceApplicationAnnotation = Application.ios.delegate.prototype.applicationOpenURLSourceApplicationAnnotation;
}
}
Application.ios.delegate.prototype.applicationOpenURLSourceApplicationAnnotation = (application, url, sourceApplication, annotation) => {
const ourResult = true;
// @todo: do our logic here.
let oldDelegate = true;
if (oldapplicationOpenURLSourceApplicationAnnotation) {
oldDelegate = oldapplicationOpenURLSourceApplicationAnnotation(url, sourceApplication, annotation);
}
return ourResult || oldDelegate;
};
}
You should do this after require('nativescript-plugin-firebase');
We are trying to do deep linking in our nativescript ios app. By writing a custom delegate and leveraging native events used for deep-linking which are
public applicationOpenURLSourceApplicationAnnotation(app: UIApplication, url: NSURL, sourceApp: string, annotation: any): boolean {}
// Handle Universal Link deep-linking
but these events are not getting triggered if we have firebase plugin for nativescript added to the project.
The problems seems to be that firebase has already overrode the above method using FBSDK for push-notifications.
Here is version I use :
platform: iOS iPhone 6 - any version (tested on version 10.3 (14C92) nativescript plugin firebase : 3.11.3 tns info : angular : 1.4.0 nativescript │ 2.5.3
tns-core-modules │ 2.5.0 tns-android │ 2.5.0
tns-ios │ 3.0.1
here is a working example i'm following https://github.com/ddfreiling/tns-ng-deeplink