ios - 如果您的应用程序被 iOS 系统终止,它会生成崩溃报告吗?
<p><p>在设备上运行时(iOS 8),我认为系统可能会在我的应用程序暂停时终止我的应用程序,因为内存或后台任务运行时间过长。我怀疑这是因为当我恢复应用程序时它已经返回到 Root ViewController ,除非应用程序重新启动,否则这是不可能的。</p>
<p>但是,在查看设备日志时,我从未看到它的崩溃报告。</p>
<p>如果系统终止您的应用程序,它会始终生成崩溃报告吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>如果应用程序被低内存杀死通常 <a href="https://developer.apple.com/library/ios/technotes/tn2151/_index.html" rel="noreferrer noopener nofollow">generates a low memory report:</a> </p>
<blockquote>
<p>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.</p>
<p>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.</p>
</blockquote>
<p>这个报告通常可以在崩溃日志中看到,但根据我的经验,这个日志并不能保证。</p>
<p> <a href="http://www.raywenderlich.com/23704/demystifying-ios-application-crash-logs" rel="noreferrer noopener nofollow">An example of a memory report:</a> </p>
<pre><code>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
</code></pre>
<p>其实这是 crashlytics 团队的问题之一 <a href="http://support.crashlytics.com/knowledgebase/articles/123408-do-you-catch-out-of-memory-crashes" rel="noreferrer noopener nofollow">trying to solve</a> :</p>
<blockquote>
<p>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.</p>
<p>However, we are working on a system that will produce a record of these events.Stay tuned!</p>
</blockquote>
<p>关于后台崩溃,通常你会得到一个类似 <a href="https://stackoverflow.com/questions/5183171/myapp-has-active-assertions-beyond-permitted-time-crash-corelocationregistra" rel="noreferrer noopener nofollow">this message:</a> 的崩溃日志。 </p>
<pre><code>Application Specific Information:
MyMapApp has active assertions beyond permitted time:
{(
<SBProcessAssertion: 0x63a07a0> identifier: CoreLocationRegistration process: MyMapApp permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1234 preventSuspendpreventIdleSleep ,
<SBProcessAssertion: 0xa095050> identifier: CoreLocationBackgroundClient process: MyMapApp permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:1234 preventSuspendpreventIdleSleep
)}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如果您的应用程序被 iOS 系统终止,它会生成崩溃报告吗?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/29176900/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/29176900/
</a>
</p>
页:
[1]