克服 RestKit 中 RKReachabilityObserver 的问题
我最近发布了关于实现 RKReachabilityObserver 的最佳方式( RestKit 项目)在我的 iOS 项目中。
mja 善意地告诉我,有一个可用的单例,我在应用程序的各个点上实现了它。我将 kBaseUrl 设置为 IP 地址以避免 DNS 问题,并测试了以下结果:
- 如果 IP 可访问并且设备有接收,则观察器按预期工作,延迟最小。
- 如果 3G 信号可用但无法访问服务(如果您使用 英国沃达丰),观察者需要很长时间才能报告其结果,并且偶尔根本没有反应。
- 当使用 WiFi 且网络繁忙/拥塞时,会出现与上述相同的行为。
我可以做些什么来提高 RKReachabilityObserver 的可靠性吗?也许可以通过替代实现?
I posted recently about the best way to implement RKReachabilityObserver (part of the RestKit project) in my iOS project.
mja kindly informed me that there was a singleton available which I implemented at various points in my application. I set the kBaseUrl to an IP address to avoid DNS issues and tested with the following results:
- If the IP is reachable and the device has reception, the observer works as expected with only minimal delay.
- If 3G signal is available but the service can't be reached (happens a lot if you're on Vodafone in the UK), the observer takes a very long time to report its result and occasionally doesn't respond at all.
- When on WiFi and the network is busy/congested, the same behaviour as above is noted.
Is there anything I can do to improve the reliability of the RKReachabilityObserver from my end, perhaps via an alternative implementation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您始终可以尝试使用
Reachability
Apple 的示例。该类提供了 getter 和通知机制来确定和观察设备可达性状态的变化。至于 RKReachabilityObserver,我认为仍在进行改进操作的工作。您能指出您的设备运行的是哪个 iOS 版本吗?
You can always try to use the
Reachability
example by Apple. The class provides both getter and notification mechanism to determine and observe the changes in device's reachability status.As for the RKReachabilityObserver, i think there is still work underway to enhance the operation. Can you indicate which iOS version do you run on the device?