简体   繁体   中英

iphone 3g network problem

does the code for checking network availability works well with 3g.(provided it works fine with wifi and 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. 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.

I would suggest reading through this best practices guide , and then studying the Reachability example source code . That is the "apple prescribed" approach.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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