简体   繁体   中英

iOS crash due to cpu usage event

My iOS application is crashing randomly in a remote site due to a CPU usage warning, which is not reported in Crashlytics. How do I interpret the warning below?

Event:            cpu usage
Action taken:     none
CPU:              90 seconds cpu time over 162 seconds (55% cpu average), exceeding limit of 50% cpu over 180 seconds
CPU limit:        90s
Limit duration:   180s
CPU used:         90s
CPU duration:     162s
Duration:         162.40s
Duration Sampled: 10.30s
Steps:            11


Hardware model:   iPad7,5
Active cpus:      2

iOS employs a CPU watcher for background processes. When the CPU usage exceeds 80%, the process will be killed. It's not a "crash" per se but a process kill. The above is just a warning that you might be approaching the allotted CPU limits.

When the crash happens, you can plug the device in xcode and goto Window -> Devices and Simulators -> View Device Logs . The crash report will mention the heaviest stack trace. That should point to the required code.

EDIT:

iOS now provides MetricsKit which allows you to get process kill information (including stack trace) at run time. This can then be uploaded to a sever or you could do Crashlytics.error() to get this info on crashlytics.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM