如何在没有用户交互的情况下禁用wifi辅助

如何在没有用户交互的情况下禁用wifi辅助

问题描述:

我有几个必须通过wifi而不是移动数据通过编程方式调用的URL.

I have couple of URLs that has to be called(programatically) through wifi not with mobile data.

WIFI ASSIST 处于打开状态时,只要wifi弱,数据包就会通过移动数据进行传输.

As WIFI ASSIST is on , whenever the wifi is weak ,packets get transferred through Mobile data.

我想阻止这种情况的发生.

I would like to stop this from happening.

据我研究,没有没有API可以切换wifi辅助以编程方式打开和关闭

As far as I have researched, there is no API to toggle wifi assist switch on and off programatically

我可以借助我认为的可达性类来确定用户是否可以打开移动数据和wifi,并且可以提醒用户不要关闭wifi助手,但这是非常糟糕的用户体验.

I can find if the user has mobile data and wifi on with the help of Reachability Class I believe and I can alert the user to keep wifi assist off but this is a very bad user experience.

所以我决定看看是否有可能在 iOS移动配置文件的帮助下完成.

so I decided to look if its possible to be done with the help of iOS mobile configuration file.

但是我在Apple配置配置文件参考中找不到与wifi-assist相关的任何键.

But I couldn't find any keys related with wifi-assist in Apple configuration profile reference.

所以我想知道,是否可以强制将wifi用于某些URL.

so I am wondering , is it possible to force wifi to be used for certain URLs.

我记得使用VPN点播可以做到这一点,我们可以通过VPN访问某些域.

I remember this is possible with VPN ON DEMAND we can have certain domains to be accessed via VPN.

我想知道是否也可以通过配置文件对wifi进行同样的操作

I am wondering if same is possible for wifi as well through configuration profile

欢迎提出任何建议.

就像其他人提到的那样,在iOS中没有办法以编程方式来操纵此设置.这并不是您真正要问的问题,因为您似乎已经知道答案是否".

As others have mentioned, there is no way to do manipulate this setting programmatically in iOS. This is not really what you are asking, as you seem to already know the answer to this is "No".

您在询问有关配置文件的信息,因此我假设它们是受管设备.不幸的是,据我所知没有配置配置文件有效负载会强制受管设备禁用Wi-Fi Assist.

You are asking about the configuration profile, so I am assuming these are managed devices. Unfortunately, there is no configuration profile payload I am aware of that forces the managed devices to disable Wi-Fi Assist.

但是,我认为您的意图与要求的有所不同.我认为您基本上拥有一个与只能通过Wi-Fi网络(可能是公司Wi-Fi网络)访问的资源进行通信的应用程序.如果该应用在移动电话上尝试连接到资源,则将无法连接.在某些情况下,当Wi-Fi信号较弱时,设备会尝试提供帮助并切换到蜂窝网络,从而导致应用程序出现问题.如果我们能找到一种方法来强制iOS在您的应用运行时不利用Wi-Fi Assist,那么您的状态将会很好.

Your intent, however, is a bit different than what is being asked, I believe. I think you basically have an app that communicates with a resource that is only accessible via the Wi-Fi network (likely a corporate Wi-Fi network). If the app tries to connect to the resource while on cellular, it will not be able to connect. In some cases, when the Wi-Fi signal is weak, the device tries to be helpful and switches to cellular, causing issues with the app. If we could figure out a way to force iOS to not take advantage of Wi-Fi Assist when your app is running, you would be in good shape.

如果您可以将此应用程序安装为托管应用程序,则有一种方法可以识别该应用程序仅应允许在Wi-Fi连接上运行.将网络使用规则AllowCellularData设置为false应该可以做到这一点(请参阅

If you can install this app as a managed app, there is a way to identify that the app should only be allowed to run on a Wi-Fi connection. Setting the network usage rules AllowCellularData to false should do this (see this for more details). The thing I am not sure of with this solution, is whether this simply causes the connections to fail when Wi-Fi Assist is on and active, or if it makes iOS prefer to not use Wi-Fi assist when the app is running because it cannot connect over cellular. So I think you can tell an app to only connect over WiFi, but it doesn't really give you a better solution to your user experience problem. The only think it really buys you is that your app connection won't ever try to connect when connected to cellular. There is a chance, however, if you change this value to false for your app bundle ID, it will prevent Wi-Fi Assist from enabling when your app is running. I don't have access to MDM to try it out, but you could test and see.

最终,考虑到这可能是公司设备的情况,我认为您将必须通过用户培训来解决此问题.好消息是,这是一次性的步骤.当然,当Wi-Fi信号弱但蜂窝信号强时,用户的网络性能可能会略有下降.如果这些设备是公司设备,而公司应用程序大部分只能在公司的Wi-Fi网络上运行,那么这无关紧要.

Ultimately, given that this is probably a corporate device situation, I think you are going to have to address this through user training. The good news is that this is a one-time step. Sure, users may have slight degradation of network performance when Wi-Fi signal is weak but cell signal is strong. This does not matter as much if these are corporate devices where the corporate apps will mostly work only on the company's Wi-Fi network.

您提到的另一种解决方案,基本上是使用按需VPN提供与内部资源的连接.这是额外的基础结构工作,您已经提到过,所以我不确定是否可以选择.

Another solution is what you mentioned, basically using on-demand VPN to provide a connection to the internal resources. This is additional infrastructure work, and you already mentioned it, so I'm not sure if it is even an option.

显然,另一种解决方案是通过防火墙公开网络资源,这可能使您可以通过蜂窝网络访问网络资源.我怀疑由于安全限制,这是不可能的.

Obviously, the other solution would be to expose the network resources through your firewall, which could allow you to access it over cellular. I'm suspecting this is not possible due to security constraints.

不幸的是,在这个领域没有很多好的选择.但是,希望有某种方法可以做到,因为Sonos似乎已经做了一些事情 允许他们的应用在流式传输到本地网络资源时避免切换到WiFi助手:

Unfortunately, there are not a lot of good options in this space. However, have hope that there is some way to do it, as Sonos appears to have done something to allow their app to avoid switching to WiFi Assist while streaming to a local network resource: https://sonos.custhelp.com/app/answers/detail/a_id/4257/~/wi-fi-assist-and-sonos

我想知道您是否可以让您的应用打开与固定本地网络资源的流音频连接,从而导致其使用Wi-Fi.这是一个非常疯狂的骇客,但是由于比特率足够低的音频文件流传输,它可以满足您的需要,同时又不会占用太多的网络吞吐量.

I wonder if you could have your app open a streaming audio connection to a fixed local network resource, which would cause it to use Wi-Fi. It's a pretty crazy hack, but with a low enough bitrate audio file streaming, it might do what you need while not eating up too much of the network throughput.

根据Apple的关于Wi-Fi Assist的说明:

  • 如果您有数据,Wi-Fi Assist不会自动切换到蜂窝网络 漫游.
  • 只有当您的应用程序在 前台,并且不会在后台下载时激活 内容.
  • 某些第三方应用未激活Wi-Fi Assist 流音频或视频,或下载附件,例如电子邮件 应用程序,因为他们可能会使用大量数据.
  • Wi-Fi Assist won't automatically switch to cellular if you're data roaming.
  • Wi-Fi Assist only works when you have apps running in the foreground and doesn't activate with background downloading of content.
  • Wi-Fi Assist doesn’t activate with some third-party apps that stream audio or video, or download attachments, like an email app, as they might use large amounts of data.

当然,您可以考虑的另一种可能的解决方案是改善Wi-Fi覆盖范围,以使信号变得足够差,以至于不需要Wi-Fi Assist.我知道这可能不可行,但想把它放在那里.

Of course the other possible solution that you could consider is improving your Wi-Fi coverage to that the signal doesn't get bad enough for Wi-Fi Assist to be needed. I know this may not be feasible, but wanted to put it out there.

祝你好运!