后台状态下如何处理网络
I am sending email using SMTP Implementation .Now i am switching to another app network to be suspend. How to handle network not to be suspended.
问候,
Arunkumar.P
I am sending email using SMTP Implementation .Now i am switching to another app network to be suspend. How to handle network not to be suspended.
Regards,
Arunkumar.P
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
登录iOS开发中心,搜索“后台任务”,您将找到您需要的文档。
更清楚地说,每次您的应用程序要启动一个可能需要一些时间才能完成并且即使在后台也应该处于活动状态的任务时,您应该在此类任务开始之前声明一个 UIBackgroundTaskIdentifier,并告诉 iOS 这是该任务需要在后台运行。而且你还必须确保当你的任务结束时,你应该总是告诉iOS它已经完成并且不再需要特殊的后台权限。
您的代码应如下所示:
Login to iOS Dev Center, and search "background task", you'll find the document you need.
To be more clear, every time your app is to start a task that may take some time to finish and should be alive even in the background, you should declare a UIBackgroundTaskIdentifier before such a task starts, and tell the iOS that this is the task that needs to run in the background. And you also have to make sure that when your task ends, you should always tell iOS that it's finished and no more special background permission is needed.
Your code should look like this: