后台的IOS可达性通知 [英] IOS Reachability notification in Background

查看:88
本文介绍了后台的IOS可达性通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使他在后台,我想在用户上线后立即完成一些任务。我正在使用Reachability类来检查互联网。但是当我在后台时,这堂课并没有通知我。我知道人们早些时候会问这个问题,但那里没有任何解决方案。如果我使用 beginBackgroundTaskWithExpirationHandler
它只给我3到4分钟,之后如果网络改变我没有得到任何通知。请建议我。我认为这是可能的,因为本机邮件应用程序以这种方式工作,我的应用程序仅支持iOS7。

I want to do some tasks as soon as user comes online even he is in background. I am using Reachability class for checking internet. But this class is not notifying me when i am at background. I know people asked this question earlier but didn't got any solutions there. If i use beginBackgroundTaskWithExpirationHandler. It gives me 3 to 4 min only, after that if network change i am not getting any notification. Please suggest me something.I think it is possible because native mail app work in that manner and my app support iOS7 only.

推荐答案

当应用在后台时,您无法获得通知,您可以利用新的iOS 7后台获取功能。这是一个教程
http://www.objc.io/issue-5 /multitasking.html

You cannot get notification form your classes while the app is in the background, you can make use of the new iOS 7 background fetching possibilities. Here is a tutorial http://www.objc.io/issue-5/multitasking.html

这篇关于后台的IOS可达性通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆