简体   繁体   English

iPhone 3G网络问题

[英]iphone 3g network problem

does the code for checking network availability works well with 3g.(provided it works fine with wifi and 2g). 3g是否可以很好地检查网络可用性的代码(前提是wifi和2g可以正常工作)。 Whether i should send the message to the destination and then show the error or first check for network availability. 我是否应该将消息发送到目的地,然后显示错误或首先检查网络可用性。

I don't have experience from the iPhone, but in general detecting network presence is hard. 我没有使用iPhone的经验,但是通常很难检测到网络存在。 It can change within a very short time since you last tested it, so any result from the test will still be unreliable. 自您上次测试以来,它可能会在很短的时间内发生变化,因此测试结果仍然不可靠。

I would suggest trying to send the data, if it's something you (or the user) want to send out anyway, there is no loss in trying. 我建议尝试发送数据,如果无论如何您(或用户)都想发送数据,则尝试不会有任何损失。 It's better to try, and get a failure from eg TCP (having done retries automatically as usual), than to decide at a single moment that sending is impossible. 尝试并从TCP(如往常一样自动重试)中获取故障要比一瞬间决定无法发送消息更好。

I would suggest reading through this best practices guide , and then studying the Reachability example source code . 我建议您通读此最佳实践指南 ,然后研究“可达性”示例源代码 That is the "apple prescribed" approach. 那就是“苹果规定”的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM