从WiFi切换到3G时出现网络错误 [英] Network error while switching from WiFi to 3G

查看:70
本文介绍了从WiFi切换到3G时出现网络错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的iPhone应用程序基于Web,可以在WiFi和3G中运行时正常工作但是问题是当我在WiFi上运行该应用程序并将其最小化,然后关闭WiFi并切换到3G时,它显示没有网络.

My iPhone app is web based.It works fine while running in WiFi and in 3G But the problem is when I run the app on WiFi and minimize it,and turn off the WiFi and switch to 3G-it shows no network.

以用户为例-当他们在WiFi下使用该应用程序而熄灭时,它无法与3G网络连接.我正在使用Apple的Reachability类来检查网络连接有人请告诉任何解决方案

In user's case-when they use the app under WiFi and goes out it failed to connect with 3G network.I am using apple's Reachability class to check the network connection Anybody please tell any solution

如果连接断开或从WiFi切换到3G,我是否可以编写一些重新连接的代码?

Do i code something to reconnect if the connection lost or switch from WiFi to 3G ?

推荐答案

您可以使用 connection:didFailWithError:并实现到您的方法中以重新连接用户.

You can use connection:didFailWithError: and implement into your method to reconnect your user.

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    [self reconnect];
}

- (void)reconnect
{
   //reconnect your user
}

希望它能对您有所帮助!;)

I hope it can help you ! ;)

这篇关于从WiFi切换到3G时出现网络错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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