开发者

Is there a way to turn on wifi on iphone through your app's code?

I am building an app using iPhone SDK 4. Is there a way to programmatically turn on the Wifi on an i开发者_如何转开发Phone/iPodTouch (iOS 4 specifically) if it is switched off ? I want to be able to turn on Wifi (if its turned off) after alerting the user and taking his/her decision into account.

Thanks,

Abhinav.


No, you can't override the user's settings for the device itself.

You can set the app to require Wifi by putting the UIRequiresPersistentWiFi key into the apps Info.plist file. This will evoke a system dialog asking the user to activate WiFi if it is not available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜