Over the past few weeks, my team has been tracking an issue which only seems to come up on older apple hardware. The issue is our app receives a push notification, then can not get initialized fast enough and apple’s watchdog process kills it at the 5 second mark (it is the badf00d code, there is some talk about it around the internet). In terms of the reproducible case for us:
- Launch and Log into the App
- Once the app is idle, close and kill the app.
- Turn screen off (make phone sleep)
- Receive push notification to launch app.
- Expect App to wake phone up here.
All of our testing has been on an iphone 6 and iphone X, so I can not say which generation begins working consistently. On the X, we can not reproduce the issue. On the 6, we get varying behaviors:
A) Screen is on: App comes ups fine
B) Screen is off, phone is plugged in and charging: App comes up some of the time.
C) Screen is off, not plugged in/charging: App never comes up (completely reproducible, in other words)
The log that appears is:
Executing termination for reason (none) with request: <FBSProcessTerminationRequest: 0x1098602d0; label: “watchdog provision violated”; exceptionCode: “Watchdog Violation (0x8BADF00D)”; reportType: CrashLog; explanation: “process-launch watchdog transgression: exhausted CPU time allowance of 5.00 seconds”>
We’ve done a lot of digging to find that our code is not getting hit, this time is spent preparing our code to run. We are building via webpack with AOT, and also trying with uglify gets us a bit further, but we still get cut off with “scene-create” instead of “process-launch”. We have tried basically every debugging option we can think of, nothing has really come up with any better information.
Our app is 45.5 megabytes. I do not believe we have a particularly large amount of non-vendor source code, so I am beginning to wonder if the amount of vendor code and the speed at which nativescript-angular loads is the real issue. We are using all the latest dependencies. I was curious to see if anybody is able to reproduce this with their app, or if anyone has any suggestions as to how we can minimize this launch time.