使用 Swift 或 Objective-C 在 iOS 中以编程方式启用个人热点

Hus*_*bir 3 cocoa-touch objective-c ios swift

我正在寻找一种使用 Swift 或 Objective-C 在 iOS 中以编程方式启用个人热点的方法,但没有看到任何 API 或实现该目的的方法。

我的问题是,甚至有可能做到这一点吗?

苹果允许吗?

另外,根据 Apple 开发人员文档HotSpot Helper,我们可以实现哪些控件?

Hotspot Communication
Hotspot helpers can use these APIs to communicate with the hotspot even when Wi-Fi is not the default route.

func bind(to: NEHotspotHelperCommand)
    Binds a URL request to the network interface associated with the hotspot helper command instance.
    In-Provider Networking
    Network APIs for use by all types of NetworkExtension providers and by hotspot helpers.
Run Code Online (Sandbox Code Playgroud)

小智 6

这不可能。来自苹果论坛:

\n
\n

\xe2\x80\x99s 无法以编程方式执行此操作。您可以使用\n \n获取iOS设备\xe2\x80\x99s当前的Wi-Fi网络SSID CNCopyCurrentNetworkInfo,但\xe2\x80\x99s无法获取相应的凭据。

\n
\n

如果 iOS 确实允许这样做,这将带来隐私和安全风险。也没有专用 API 可以执行此操作。然而,正如 Pushkraj Lanjekar 所说,

\n
\n

您只需Settings从应用程序打开设备视图即可。

\n
\n

无法以编程方式控制 iOS 设备上的个人热点。\n不过,此 Apple 论坛链接可能会有所帮助;https://developer.apple.com/forums/thread/113933。

\n