当网络从 3G 切换到 2G 时 iPhone 应用程序冻结
我找不到任何相关信息,但确实需要确定它是否不会发生,或者证明它确实发生的文档是否太难找到!
背景故事:
当我的应用程序在 3G 信号较弱的 iPhone 上运行时,因此从较弱的 3G 来回切换到较强的 2G,反之亦然,它似乎冻结了(应用程序完全冻结) 5-10 秒)。我收到过来自四面八方的报告,但我无法复制这种情况,因为我所在地区的 3G 信号太强了!
如果我紧紧地挤压 iPhone 4,那么我可以将信号调暗到足以让我收到一条警报,告诉我没有蜂窝数据网络……然后它会短暂切换到 2G。这确实会导致冻结,我将其跟踪到导致警报解除后调用应用程序委托方法“applicationDidBecomeActive”的警报,但没有像我在考虑正常挂起/恢复过程时所预期的那样“applicationWillResignActive”。
我改变了代码中的一些逻辑来处理这个问题,现在问题已经解决了。
问题:
当手机从 3G 切换到 2G 时,是否会调用任何应用程序委托方法,反之亦然?应用程序是否会像上述情况一样暂时失去其活动状态,然后重新获得它?上述问题似乎完全复制了我的用户所经历的情况,除了我收到“无蜂窝数据网络”警报这一事实,这显然改变了一些情况。他们没有收到此警报,但仍然冻结。
谢谢
I can't find any information on this but really need to know for sure if it doesn't happen, or if the documentation that proves it does happen is just too hard to find!
The background story:
When my app is running on an iPhone that has a weak 3G signal, and therefore switches backwards and forwards from a weak 3G to a strong 2G and vice-versa, it seems to freeze (the app, a complete freeze for 5-10 seconds). I have had reports of this from far and wide but it's something I can't replicate as my 3G signal is too strong in my area!
If I squeeze my iPhone 4 tightly, then I can dim the signal enough that I get an alert telling me that there is no cellular data network ... before it switches to 2G briefly. This DOES cause a freeze, and I tracked it down to the alert causing the app delegate method "applicationDidBecomeActive" to be called after the alert is dismissed, but no "applicationWillResignActive" as I had expected when thinking of the normal suspend/resume process.
I changed some of the logic in my code to deal with this, and that problem is now resolved.
The question:
Are any app delegate methods called when the phone switches from 3G to 2G and vice-versa? Does the app momentarily lose it's active state and then regain it like it does in the above situation? The problem above seems to replicate exactly what my users are experience EXCEPT from the fact that I get the "no cellular data network" alert which obviously changes things a bit. They don't get this alert, but they still get the freeze.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您也许可以使用可达性来跟踪这一点。
您可以在此处找到它。
You might be able to track this using Reachability.
You can find it here.