Skip to content

Instantly share code, notes, and snippets.

@johnny77221
Created October 24, 2016 07:07
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save johnny77221/bcaa5384a242b64bfd0b8a715f48e69f to your computer and use it in GitHub Desktop.
Save johnny77221/bcaa5384a242b64bfd0b8a715f48e69f to your computer and use it in GitHub Desktop.
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];
}
@johnny77221
Copy link
Author

@hongseok so sad to hear this, did mikengyn 's solution worked and pass the review?

@shaibow
Copy link

shaibow commented May 16, 2017

how can use this code for listing installed apps in ios 10 ?

@johnny77221
Copy link
Author

@shaibow No ideas now, the method -canOpenURL has been restricted since iOS9, there's no way to do this right now I think

@janicechau12
Copy link

I am facing the same issue as @hongseok as well.

Guideline 2.5.1 - Performance - Software Requirements
Your app uses or references the following non-public APIs:

  • LSApplicationWorkspace

Is there any other options beside using LSApplicationWorkspace?

@kingbin
Copy link

kingbin commented Jan 2, 2018

I'm also getting this rejection from the app store.

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