Reputation: 2352
I have an app (written in Swift) that currently crashes after the user goes to a particular view then closes the app or turns off the device for several hours.
I'm wondering what happens to the app after a long period of inactivity:
-viewDidLoad
run again or just -viewWillAppear
?I find it hard to test because in order to recreate this issue I have to switch off the device while being on a certain view and then leave off or several hours.
From a different perspective, the crash log shows the following:
Exception Type: 00000020
Exception Codes: 0x000000008badf00d
Exception Note: SIMULATED (this is NOT a crash)
Highlighted by Thread: 0
Application Specific Information:
matt.myApp-v2 failed to launch after 20.00s (launchIntent: foreground-interactive)
Elapsed total CPU time (seconds): 2.030 (user 2.030, system 0.000), 5% CPU
Elapsed application CPU time (seconds): 0.006, 0% CPU
....
Error Formulating Crash Report:
Failed while requesting activity/breadcrumb diagnostics
Upvotes: 1
Views: 1626
Reputation: 77641
0x000000008badf00d
This is a hard coded error for the app watchdog. "Ate bad food".
It means that your app is being terminated on launch because it is taking too long for the application:didFinishLaunchingWithOptions:
function to return.
My guess is that you're making a long core data call or network request in there.
The crash here is on startup though. Not a crash that's happening after a long period of time.
I suspect that your app is being terminated by the OS due to memory pressure from another app but then when launching the app is trying to continue doing something that it is no longer actually doing and getting stuck somewhere.
What does your application:didFinishLaunchingWithOptions:
function do?
Upvotes: 2
Reputation: 1077
The problem you are facing is because iOS handle device memory dynamically. If the user open an app that requires a lot of memory, it can close your app in the background to have free memory available.
If the user go back to your app, it will launched again like the first time the app is open or if the user has killed your app in the application switcher.
You need to be familiar with the App Life Cycle described in this documentation from Apple. It described the different state in the application can be and what code is called when the application resumed activity.
My guess is that your view is calling something that is not initialized when the application resumes activity, hence crashing the application.
To have further debugging information, you should ask your user to send you a crash report. If the app is distributed on the App Store, he or she should enable Data & Diagnostics to send them like described in this question.
Upvotes: 1