如何知道我的 iPhone/iPad 连接的是 2G 还是 3G?

发布于 2024-12-15 06:58:39 字数 313 浏览 6 评论 0原文

我试图检查设备是否通过 2G(GPRS、EDGE)或 3G(UMTS、HSDPA)连接。

我只从 此处 找到了 Reachability 示例类( Apple Dev 示例)

此示例仅检查其 Wifi 还是 WWAN。我想用它来决定是下载小数据还是大文件。因为 GRPS 和 UMTS 之间有很大的不同。

能区分2G和3G吗?

I was trying to check wether the device is connected via 2G (GPRS, EDGE) or 3G (UMTS, HSDPA).

I only found the Reachability example class from here (Apple Dev Example)

This example only check wether its Wifi or WWAN. I wanna use it to decide wether I download the small data or the huge files. As it is big different between GRPS and UMTS.

Is it possible to distinguish 2G and 3G?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜灵血窟げ 2024-12-22 06:58:39

由于您无法通过官方方式获取此信息,因此如何截取屏幕截图并对状态栏网络连接图标进行一些解析器/图像处理。丑陋,但会起作用。而且会很有趣:)

Since you can not get this information the official way, how about taking a screenshot and make some parser / image processing for the status bar network connectivity icon. Ugly, but would work. And would be fun :)

旧时模样 2024-12-22 06:58:39

这在iOS7中是完全可能的。请检查这个答案

希望如此帮助

This is totally possible in iOS7. Please check this answer

Hope this helps

楠木可依 2024-12-22 06:58:39

我认为最好的选择是“重新思考”您的流程:

  • 没有官方 API 来确定用户是 2G 还是 3G

  • 3G 在技术上比 2G 快,但在实践中,很多情况下 3G 非常非常慢(覆盖范围差、流量太大等)

我是一个移动互联网的重度用户,而且我可能拥有比 3G 更好的 2G。
还要考虑到 3G 在良好条件下速度很快,但它并不是真正设计用于支持大量数据(在运营商端和设备电池端)...

这就是为什么您应该根据以下情况决定下载小文件或大文件WiFi/非 WiFi。

不过,对于“小文件”,不要使其“太小”,大多数将在 WWAN 上使用您的应用程序的人可能会有正确的覆盖范围。

(根据我在法国和比利时使用相当好的受众应用程序的经验)

I think the best option is to "rethink" your process:

  • There are no official API to determine whether the user is 2G or 3G

  • 3G is technically faster than 2G but in the practice there are a lot of cases where 3G is very, very slow (bad coverage, too much traffic, etc.)

I'm an heavy mobile internet user and it can happen I have a better 2G than 3G.
Take also into account 3G is fast in good conditions but it's not really designed to support high volumes of data (at operator side, and at device's battery side)...

That's why you should take the decision to download small or big file based on WiFi / non-WiFi.

Nevertheless, for the "small file", do not make it "too small", most people that will use your app on WWAN will probably have correct coverage.

(Based on my experience with quite good audience apps in France and Belgium)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文