确定iPhone上的辍学后何时EDGE连接恢复 [英] Determining when an EDGE connection comes back after a dropout on an iPhone

查看:77
本文介绍了确定iPhone上的辍学后何时EDGE连接恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将Apple的Reachability示例加入到我自己的项目中,因此我知道我是否有网络连接 - 如果我没有网络连接,我不打扰发送和请求。我决定使用状态通知实现,因为看起来更容易在后台更新可访问性,并且立即获得当前结果,而不是每当我想建立网络连接时启动同步请求。

I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification implementation because it seemed easier to have the reachablity updated in the background and have the current results available immediately as opposed to kicking off a synchronous request whenever I want to make a network connection.

我的问题是,我在EDGE网络上开始得到假阴性 - 手机有连接,但应用程序认为不是这样。我的理解是你没有得到通知时,EDGE连接,所以我的假设是,我失去了并恢复了连接在某一点。重新启动应用程序通常足以看到网络连接。

My problem is that I start getting false negatives when on an EDGE network - the phone has connectivity, but the app thinks this isn't the case. My understanding is you don't get a notification when an EDGE connection, so my assumption is that I lost and regained the connection at some point. Restarting the app is usually sufficient to see the network connection.

这不是一个最佳解决方案,所以我想知道是否有其他人遇到这个问题,并有任何想法

This isn't an optimal solution, so I was wondering if anybody else came across this problem and had any thoughts on a solutions.

(我不知道这是否适用于3G;我正在运行第一代iPhone)。

(I don't know whether this applies to 3G as well; I'm running a first gen iPhone).

推荐答案

对于我来说,可达性通知对我来说似乎也不可靠,用于检测Wi-Fi。所以我只是使用轮询。

Reachability notificataions didn't seem to be reliable for me either, for detecting Wi-Fi. So I just use polling instead. Checking every 5 seconds seems to do no harm.

- (void) checkReachability {
    BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == ReachableViaWiFiNetwork);

    // Do something...

    [self performSelector:@selector(checkReachability) withObject:nil afterDelay:5.0];
}

这篇关于确定iPhone上的辍学后何时EDGE连接恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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