如何在 iPhone SDK 4.1 上触发 WiFi 连接

发布于 2024-09-28 01:52:56 字数 140 浏览 0 评论 0原文

有时,iOS 设备不会自动连接到可用的 WiFi,但如果启动 Safari 并尝试浏览到任何站点(或转到“设置”->“Wi-Fi”并选择所需的网络),它就会自动连接到可用的 WiFi。这可能是出于节省电池的原因。

如何从您的应用程序触发此操作?

Sometimes the iOS device will not connect to the available WiFi automatically, but it will if Safari is launched and try to browse to any site (or go to Settings->Wi-Fi and select the desired network). This is probably for battery savings reasons.

How to trigger this from your app?

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

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

发布评论

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

评论(2

妞丶爷亲个 2024-10-05 01:52:56

如果需要,更高级别的 Cocoa Touch 网络 API 将尝试打开无线电。在此之前,它们会尽可能保持关闭状态以节省电池电量(在一定的超时后)。

Safari 可能使用高级 HTTP API 之一进行浏览。

The higher level Cocoa Touch network APIs will attempt to turn on the radios if needed. Until then they are kept off as much as possible to conserve battery power (after certain time-outs).

Safari probably uses one of the high level HTTP APIs for browsing.

甜尕妞 2024-10-05 01:52:56

您可以在 Info.plist 中尝试类似 UIRequiredDeviceCapabilitywifi 的内容。它实际上意味着“持久 wifi”(即即使显示器处于睡眠状态也保持 Wi-Fi 开启),但它也可能会触发重新连接。

编辑:或者,UIRequiredDeviceCapabilitywifi。还有 UIRequiresPersistentWiFi ,它的作用略有不同。

You can try something like <key>UIRequiredDeviceCapabilities</key><array><string>wifi</string></array> in Info.plist. It actually means "persistent wifi" (i.e. keep Wi-Fi up even when the display is asleep), but it might also trigger a reconnection.

EDIT: Alternatively, <key>UIRequiredDeviceCapabilities</key><dict><key>wifi</key><true/></dict>. There's also <key>UIRequiresPersistentWiFi</key><true/> which does something slightly different.

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