Create a gist now

Instantly share code, notes, and snippets.

opening iOS BLE setting from app
NSURL *bluetoothURLOS8 = [NSURL URLWithString:@"prefs:root=General&path=Bluetooth"];
NSURL *bluetoothURLOS9 = [NSURL URLWithString:@"prefs:root=Bluetooth"];
NSURL *bluetoothURLOS10 = [NSURL URLWithString:@"Prefs:root=Bluetooth"];
if ([[[UIDevice currentDevice] systemVersion] intValue] >= 10) {
Class<NSObject> workSpaceClass = NSClassFromString(@"LSApplicationWorkspace");
if (workSpaceClass) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
id workSpaceInstance = [workSpaceClass performSelector:NSSelectorFromString(@"defaultWorkspace")];
SEL selector = NSSelectorFromString(@"openSensitiveURL:withOptions:");
if ([workSpaceInstance respondsToSelector:selector]) {
[workSpaceInstance performSelector:selector withObject:bluetoothURLOS10 withObject:nil];
#pragma clang diagnostic pop
else if ([[[UIDevice currentDevice] systemVersion] intValue] >= 9) {
[[UIApplication sharedApplication] openURL:bluetoothURLOS9];
else {
[[UIApplication sharedApplication] openURL:bluetoothURLOS8];
KYC3909 commented Dec 29, 2016

If I add this solution so, My app will be rejected or approved?


I used this solution on 3 apps, which are all passed the app store review, so I think it's safe to use it right now

iDevo commented Jan 16, 2017 edited

This might be a bit to specific but does anyone know the url to the "SIM Applications" in iOS 10?
In iOS 9 it was able with: prefs:root=Phone&path=SIMToolkit


You should use a capitalized Prefs instead of prefs on iOS 10

mikengyn commented Feb 1, 2017

App-Prefs should be used for IOS10.


@mikengyn Thanks, it works! Swift users will thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment