iPhone App:睡眠后无线连接失败
我正在编写的新应用程序遇到问题。该应用程序连接到互联网以下载在应用程序中使用的 xml 文件。它定期返回以同步数据 - 基本上是检查数据是否已更改。一切正常,但如果 iPhone 进入睡眠状态,我就会遇到问题。当它醒来十次中有九次时,无线连接就会失败。如果 iPhone 连接到 3G 网络(即不通过无线路由器)则没问题。有没有人遇到过这个问题或者对如何克服它有任何想法?
我正在使用 NSURLConnection 方法来下载数据(如果这有影响的话)。
I have a problem with a new app I am writing. The app connects to the internet to download an xml file which it uses in the app. It goes back regularly to sync the data - basically to check if it has changed. This all works fine but I am experiencing a problem if the iPhone has gone to sleep. When it wakes up 9 times out of 10 the wireless connection fails. If the iPhone is connected to a 3G network (i.e. not through a wireless router) it is fine. Has anyone experienced this problem or have any ideas on how to overcome it?
I am using the NSURLConnection methods to download the data if that makes a difference.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Apple 要求在尝试任何类型的网络连接之前,检查网络可用性(例如使用 Reachability 类方法),如果网络不可用,则应避免尝试连接,而应提醒用户。
Apple requires before attempting any kind of network connection, that you check for network availability (for instance using the Reachability class methods) and, if the net is not available, you should avoid trying the connection and instead you should alert the user.