Home > database >  Enable personal hotspot programatically in iOS using Swift or Objective-C
Enable personal hotspot programatically in iOS using Swift or Objective-C

Time:11-02

I am looking for a way to enable personal Hotspot programatically in iOS using Swift or Objective-C but did not see any API or way to achieve that.

My question is that even possible to do that?

Does Apple allow that?

Also as per Apple Developer Documentation HotSpot Helper what are the controls we can achieve that ??

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.

CodePudding user response:

This is not possible. From Apple's Forums:

There’s no way to do this programmatically. You can get the iOS device’s current Wi-Fi network SSID using CNCopyCurrentNetworkInfo , but there’s no way to get the corresponding credentials.

If iOS did allow this, this would be a privacy and security risk. There is no private API to do this either. As Pushkraj Lanjekar said,

You can just open device Settings view from app.

There is no way to programatically control personal hotspot on an iOS device. This Apple Forums link may be helpful, however; https://developer.apple.com/forums/thread/113933.

CodePudding user response:

Apple don't provide any API to Turn On/Off Personal Hotspot. Rather, you can't change any user setting via code. You can just open device Settings view from app.

Apple's privacy policies will not allow you to do this.

  • Related