Please, tell us how to recreate the issue in as much detail as possible.
I am implementing PushKit in my app for a VOIP (Applozic in this case) feature. I have all of the delegates setup and everything generally works. However, when my app has been terminated (force-closed), I am having problems. The VOIP platform sends silent notifications that force my app to launch if it is not in the background. The problem is that the IOS Watchdog ends up killing my app after 1-2 seconds before everything has completed launching.
I have simpllified my applicationDidFinishLaunchingWithOptions so that it does not make any calls out to the Applozic SDK if the applicationState==Background.
Is there any code involved?
main.ios.ts
// this import should be first in order to load some required settings (like globals and reflect-metadata)
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app.module";
import app = require("application");
const { CustomAppDelegate } = require("./delegate");
app.ios.delegate = CustomAppDelegate;
platformNativeScriptDynamic({ startPageActionBarHidden: true }).bootstrapModule(
AppModule
);
My app delegate has a lot of other callbacks but here is the applicationDidFinishLaunchingWithOptions.
applicationDidFinishLaunchingWithOptions(
application: UIApplication,
launchOptions
): boolean {
console.log("applicationWillFinishLaunchingWithOptions: ", this);
if (application.applicationState == UIApplicationState.Background) {
console.log("APP STATE BACKGROUND");
return false;
}
if (application.applicationState == UIApplicationState.Inactive)
console.log("APP STATE INACTIVE");
let manager = IQKeyboardManager.sharedManager();
manager.disabledDistanceHandlingClasses.addObject(
ALChatViewController.class
);
let localNotification = ALAppLocalNotifications.alloc();
localNotification.dataConnectionNotificationHandler();
application.applicationIconBadgeNumber = 0;
application.cancelAllLocalNotifications();
if (launchOptions) {
let dictionary = launchOptions.objectForKey(
UIApplicationLaunchOptionsRemoteNotificationKey
);
if (dictionary != null) {
console.log(
"Launched from push notification: " + dictionary.toString()
);
let alPushNotificationService = ALPushNotificationService.alloc().init();
let applozicProcessed = alPushNotificationService.processPushNotificationUpdateUI(
dictionary,
APP_TRI_STATE.STATE_INACTIVE
);
if (applozicProcessed) {
console.log("APPLZOIC PROCESSED LAUNCH OPTIONS");
}
}
}
return true;
}
Quick Note: When I compile my app with AOT, I no longer get the crash though I'm still getting some odd behaviors with regards to network access. I will leave this open while I research and provide more info.
Please, provide the following version numbers that your issue occurs with:
package.json
file of your project and paste your dependencies and devDependencies here)Please, tell us how to recreate the issue in as much detail as possible.
I am implementing PushKit in my app for a VOIP (Applozic in this case) feature. I have all of the delegates setup and everything generally works. However, when my app has been terminated (force-closed), I am having problems. The VOIP platform sends silent notifications that force my app to launch if it is not in the background. The problem is that the IOS Watchdog ends up killing my app after 1-2 seconds before everything has completed launching.
I have simpllified my applicationDidFinishLaunchingWithOptions so that it does not make any calls out to the Applozic SDK if the applicationState==Background.
Is there any code involved?
main.ios.ts
My app delegate has a lot of other callbacks but here is the applicationDidFinishLaunchingWithOptions.
Console log at the time the background notification is sent: https://gist.github.com/vtjon/4fabbdf55c67e406fe6f638149849347
In the console log, there is a " Launch Event " message. At the top of my AppModule, I have:
This just prints out the message that you see and no additional logic.
Crash Log (this has times on it that are earlier than the Console Log but it's the same crash each time and the device logs are slow to load) https://gist.github.com/vtjon/f675296d93971ac0e694e59ea506549a
I have to assume that this is due to the CPU required to load Angular. I have tried a bundle version and I get the behavior.