4

I've done enough looking up to now that how this used to be possible on iOS 5.1 and below, and that it's not possible in any version above that.

But how do other apps do it?

So far, I've tried the following (tested on iOS 8.1 simulator, on Xcode):

- (void)turnOnBlueToothPressed:(id)sender {
    [[UIApplication sharedApplication] openURL:[NSURL  URLWithString:UIApplicationOpenSettingsURLString]];
}

Which opens the app's settings. Not ideal, but it is what it is.

AFAIK, using the following:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General&path=Bluetooth"]]

No longer works. Alternatively, could anyone point me to the official documentation stating that it no longer works on any version > iOS 5.1?

picciano
  • 22,341
  • 9
  • 69
  • 82
zack_falcon
  • 4,186
  • 20
  • 62
  • 108

3 Answers3

2

I have the same problem, now you can open only current app settings, sorry .....=( https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html

Joe Hallenbeck
  • 1,452
  • 12
  • 24
2

This works in iOS version 5.1 and above.

You must add URL schemes prefs in URL types in Xcode's info.plist tab like below:

url types in info.plist tab

Objective-C:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];

Swift:

UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=WIFI")!)

This will open WIFI Settings from your application.

Related SO links:

GabLeRoux
  • 16,715
  • 16
  • 63
  • 81
viral
  • 4,168
  • 5
  • 43
  • 68
  • 2
    Tested on _ios 9_ and it works, but I tried on _ios 11_, `prefs:root=Bluetooth` did not work, `App-Prefs:root=Bluetooth` did open settings, but not Blueetooth. `App-prefs:root=Bluetooth` did work on _ios 11_ so the case seems to be important. Only needed `prefs` in Url schemes – GabLeRoux Sep 27 '17 at 14:23
  • @GabLeRoux on iOS 11 do we need to add URL type too... for me non of solutions are working, any Idea? – kmithi1 Oct 09 '17 at 07:37
  • 1
    I'm upgrading to latest ios version and will try again. But I've found this github project that says ios11 has problems: https://github.com/phynet/iOS-URL-Schemes – GabLeRoux Oct 09 '17 at 14:45
0

NOTE: The following method works for all the versions below iOS 11, for higher versions the app might get rejected since it's a private API This comes under Guideline 2.5.1 - Performance - Software Requirements

Here are the list of all short url strings:

If you want open Bluetooth settings :

Swift 3 :

let url = URL(string: "App-Prefs:root=Bluetooth")
let app = UIApplication.shared
app.openURL(url!)

Use below code to just open settings:

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString))

GameLoading
  • 6,688
  • 2
  • 33
  • 57
BSK-Team
  • 1,750
  • 1
  • 19
  • 37