2 MyDelegate code blocks



I have embarked on the IOS side of my nativescript app.

I have 2 different plugins that require MyDelegate code in the app.js file.

The device logs told me I needed to rename one of the MyDelegate variables which I did.

I am having another issue.

It seems that when the last line of the second MyDelegate code runs “application.ios.delegate = MyDelegate1;”

It overwrites the first function’s “application.ios.delegate = MyDelegate1;”

Am I going to have to combine these 2 code blocks into 1?

Thank You,


if (application.ios) {
    console.log ("LINE 37")
    var MyDelegate1 = (function (_super) {
        __extends(MyDelegate1, _super);
        function MyDelegate1() {
            return _super !== null && _super.apply(this, arguments) || this;
        MyDelegate1.prototype.applicationDidFinishLaunchingWithOptions = function (app, launchOptions) {

            console.log("LNIE 45")
            try {
                console.dir('TnsOneSignal', nativescript_onesignal_1.TnsOneSignal);
                nativescript_onesignal_1.TnsOneSignal.initWithLaunchOptionsAppId(launchOptions, '');
                nativescript_onesignal_1.TnsOneSignal.IdsAvailable(function (id) {
                    console.log('id', id)
            catch (error) { 
                console.log('error', error);
            return true;
        return MyDelegate1;
    MyDelegate1.ObjCProtocols = [UIApplicationDelegate];
    application.ios.delegate = MyDelegate1;
  var MyDelegate = (function (_super) {
        __extends(MyDelegate, _super);
        function MyDelegate() {
            return _super !== null && _super.apply(this, arguments) || this;
        MyDelegate.prototype.applicationPerformFetchWithCompletionHandler = function (application, completionHandler) {
            var controller = application.keyWindow.rootViewController;
            console.log('********** controller: ', controller);
            console.log('- AppDelegate Rx Fetch event');
        return MyDelegate;
    MyDelegate.ObjCProtocols = [UIApplicationDelegate];
    application.ios.delegate = MyDelegate;


Combining the code blogs did the trick.


Yes, this quote by the great Christopher Lambert still holds true: https://www.youtube.com/watch?v=sqcLjcSloXs