IOS bluetooth app “Terminated due to signal 9” ONLY IN BACKGROUND MODE

ⅰ亾dé卋堺 提交于 2019-12-04 19:58:24

问题


I am developing an IOS app in objective c which displays the heart rate from bluetooth BLE with a corresponding graphic. If the app runs in the foreground everything forks fine without any problem.

But if the app goes in background mode the BLE measuring still continues (I am using "Uses Bluetooth LE accessories") but it is killed by the OS after some minutes or some seconds with the message "The app on iPhone quit unexpectedly --> Message from debugger: Terminated due to signal 9.

I can not find out why this happens only in background mode and not in the foreground when I see the app on the iPhone?

The CPU and memory usage is the same in foreground or background it is about 130% and 16 MB.

The app is killed after 2:40


回答1:


"All things which are done in the foreground" are done when the app is in background mode and the app is using by example "Uses Bluetooth LE accessories"! And if the CPU usage is too high iOS kills the app with "Terminated due to signal 9" not only if the memory usage is too high! (I think, this fact is missing in the Apple documentation).

To prevent the app to be killed while in background, stop doing high CPU using things, like rendering images, when the app is in background mode!



来源:https://stackoverflow.com/questions/29583277/ios-bluetooth-app-terminated-due-to-signal-9-only-in-background-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!