如果应用程序在 iPhone 中进入后台模式,如何停止运行线程?
我正在创建一个 iphone 应用程序,如果应用程序进入后台模式,我需要停止正在运行的线程,是否可以停止 iphone 应用程序中的线程? 因为如果应用程序进入前台,我的线程会连续显示位置通知警报消息。
如果有人知道请帮助我。 提前致谢。
I am creating an iphone application which i need to stop a running thread if the application went to background mode,is it possible to stop thread in iphone application?
as because my thread displays location notification alert messages continuously if application enter to foreground .
Please help me if any one knows.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您的应用程序已切换到后台,操作系统将通过调用委托的方法之一通知您:
您的应用程序不会立即冻结。您可以立即联系您的服务器(如果有)或应用程序中的任何控制器并停止显示通知。
顺便说一句:我建议您首先在真实设备上测试您的应用程序,看看切换到后台时它的行为如何。操作系统可能会为您冻结该线程。您可能不需要做任何事情。
If your app was switched to the background, the OS will let you know by calling one of your delegate's methods:
Your app won't be frozen right away. You can immediately contact your server (if any) or any controller within your app and stop displaying notifications.
btw: I suggest you first test your app on a real device to see how it behaves when switched to the background. It is possible that the OS will freeze that thread for you. Nothing might have to be done on your side.
此教程将指导您想要实现。
This Tutorial will guide you what you want to achieve.