Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
776 views
in Technique[技术] by (71.8m points)

iphone - Is there a way to toggle wifi on and off programmatically in iOS?

I done it for Bluetooth using the code on this link: Is there a way to toggle bluetooth and/or wifi on and off programmatically in iOS?

But I couldn't figure out how to do the same for Wifi. How do you switch the Wifi on/off? Is it possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's definitely not possible to turn WiFi off or on with any public (documented) API.

It might be possible to achieve this even on a non-jailbroken device using private functions.

See Apple80211Functions - there is a private function called Apple80211SetPower which is a good candidate for this job. But using it would be also interfering with automatic TX power settings - could result in either increased battery usage or decreased WiFi link quality (or both).

Of course your app would most definitely not pass App Store approval using this.

You can see how Apple80211 functions can be used if you download Stumbler source.

Stumbler SVN checkout is done by:

svn checkout http://iphone-wireless.googlecode.com/svn/trunk/ iphone-wireless-read-only

There are also two other projects that might help you start with low-level WiFi functions:

web-login-helper

BECHA


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...