OGeek|极客世界-中国程序员成长平台

标题: ios - 如果您的应用程序被 iOS 系统终止,它会生成崩溃报告吗? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 14:47
标题: ios - 如果您的应用程序被 iOS 系统终止,它会生成崩溃报告吗?

在设备上运行时(iOS 8),我认为系统可能会在我的应用程序暂停时终止我的应用程序,因为内存或后台任务运行时间过长。我怀疑这是因为当我恢复应用程序时它已经返回到 Root View Controller ,除非应用程序重新启动,否则这是不可能的。

但是,在查看设备日志时,我从未看到它的崩溃报告。

如果系统终止您的应用程序,它会始终生成崩溃报告吗?



Best Answer-推荐答案


如果应用程序被低内存杀死通常 generates a low memory report:

When a low-memory condition is detected, the virtual memory system in iOS relies on the cooperation of applications to release memory. Low-memory notifications are sent to all running applications and processes as a request to free up memory, hoping to reduce the amount of memory in use. If memory pressure still exists, the system may terminate background processes to ease memory pressure. If enough memory can be freed up, your application will continue to run and no crash report will be generated. If not, your application will be terminated by iOS because there isn't enough memory to satisfy the application's demands, and a low memory report will be generated and stored on the device.

The format of a low memory report differs from other crash reports in that there are no stack traces for the application threads. Memory usage of each process is reported in terms of number of memory pages, which as of this writing are 4KB each. You will see "(jettisoned)" next to the name of any process terminated by iOS to free up memory. If you see it next to your application's name, that confirms the application was terminated for using too much memory.

这个报告通常可以在崩溃日志中看到,但根据我的经验,这个日志并不能保证。

An example of a memory report:

Incident Identifier: 30E46451-53FD-4965-896A-457FC11AD05F
CrashReporter Key:   5a56599d836c4f867f6eec76afee451bf9ae5f31
OS Version:          iPhone OS 3.1.3 (7E18)
Date/Time:           2012-10-17 21:39:06.967 -0400

Free pages:        96
Wired pages:       10558
Purgeable pages:   0
Largest process:   Rage Masters

Processes
     Name                 UUID                    Count resident pages
Rage Masters <cc527ca9b51937c5adbe035fe27a7b12>    9320 (jettisoned) (active)
mediaserverd <3d3800d6acfff050e4d0ed91cbe2467e>     255
 dataaccessd <13d80b2e707acc91f9aa3ec4c715b9cc>     505
     syslogd <8eddddc00294d5615afded36ee3f1b62>      71
        apsd <32070d91b216d806973c8f1b1d8077a4>     171
   securityd <b9e51062610d27f727c5119b8f80dcdf>     243
     notifyd <591dd4dd804b4b8741f52335ea1fa4ab>    2027
  CommCenter <b4b87526ae086bb62c982f1078f43f81>     189
 SpringBoard <324939a437d1cca1fa4af72d9f5d0eba>    2158 (active)
  accessoryd <8f21c8b376d16e2ccb95ed6d21d8317a>      91
     configd <85efd41aceac34ccc0019df76623c7a9>     371
   fairplayd <a2eaf736b3e07c7c9a2c82e9eb893555>      93
mDNSResponder <df1cd275e4ad434e0575990e8e1da4cb>     292
   lockdownd <80d2bd44c0bcca273d48ce52010f7e65>    1204
     launchd <a5988245aade809bf77576f1d9de42c5>      72

其实这是 crashlytics 团队的问题之一 trying to solve :

These are tricky, as these events are actually separate events from crashes. Low-memory events are complex to capture as there is no known way to capture a low-memory exit with public API.

However, we are working on a system that will produce a record of these events. Stay tuned!

关于后台崩溃,通常你会得到一个类似 this message: 的崩溃日志。

Application Specific Information:
MyMapApp[1234] has active assertions beyond permitted time: 
{(
    <SBProcessAssertion: 0x63a07a0> identifier: CoreLocationRegistration process: MyMapApp[1234] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1234 preventSuspend  preventIdleSleep ,
<SBProcessAssertion: 0xa095050> identifier: CoreLocationBackgroundClient process: MyMapApp[1234] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1234 preventSuspend  preventIdleSleep 
)}

关于ios - 如果您的应用程序被 iOS 系统终止,它会生成崩溃报告吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29176900/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4