简体   繁体   English

如果UIThread长时间被阻止,iOS应用程序会被杀死吗?

[英]Will ios app get killed if UIThread is blocked for long time?

I have a strange issue. 我有一个奇怪的问题。 My app gets killed if my UI thread is blocked for long time ( say 10s). 如果我的UI线程被长时间阻止(例如10秒),我的应用程序将被杀死。 I want to repeatedly take screenshots after updating view in a loop. 我想在循环更新视图后重复拍摄屏幕截图。 This is a time consuming process. 这是一个耗时的过程。 But my app gets killed and no memory warning is received. 但是我的应用程序被杀死,没有收到内存警告。 My question is will my app get terminated if UI Thread is blocked for long time? 我的问题是,如果UI线程长时间被阻止,我的应用程序是否会终止?

This is normal. 这很正常。 Instead of letting apps freeze, iOS watches each app if they are taking a long time in the UI thread. 如果应用程序在UI线程中花费很长时间,则iOS不会监视应用程序,而是监视每个应用程序。 Is there any reason you have to take the screenshots in a single run loop? 您是否有任何理由必须在单个运行循环中截取屏幕截图? Why not just setup a CADisplayLink callback and take just one screenshot every execution? 为什么不只设置CADisplayLink回调并在每次执行时仅截取一个屏幕截图?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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