Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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

This comment has been minimized.

Show comment Hide comment
@KYC3909

KYC3909 Dec 29, 2016

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

KYC3909 commented Dec 29, 2016

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

@johnny77221

This comment has been minimized.

Show comment Hide comment
@johnny77221

johnny77221 Jan 9, 2017

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

Owner

johnny77221 commented Jan 9, 2017

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

This comment has been minimized.

Show comment Hide comment
@iDevo

iDevo Jan 16, 2017

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

iDevo commented Jan 16, 2017

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

@johnny77221

This comment has been minimized.

Show comment Hide comment
@johnny77221

johnny77221 Jan 24, 2017

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

Owner

johnny77221 commented Jan 24, 2017

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

@mikengyn

This comment has been minimized.

Show comment Hide comment
@mikengyn

mikengyn Feb 1, 2017

App-Prefs should be used for IOS10.

mikengyn commented Feb 1, 2017

App-Prefs should be used for IOS10.

@johnny77221

This comment has been minimized.

Show comment Hide comment
@johnny77221

johnny77221 Mar 7, 2017

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

Owner

johnny77221 commented Mar 7, 2017

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

@hongseok

This comment has been minimized.

Show comment Hide comment
@hongseok

hongseok Apr 6, 2017

Apple rejected this code (6, April 2017)


Guideline 2.5.1 - Performance

Your app uses or references the following non-public APIs:

“LSApplicationWorkspace”
“defaultWorkspace”
“prefs:root”

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

hongseok commented Apr 6, 2017

Apple rejected this code (6, April 2017)


Guideline 2.5.1 - Performance

Your app uses or references the following non-public APIs:

“LSApplicationWorkspace”
“defaultWorkspace”
“prefs:root”

The use of non-public APIs is not permitted on the App Store because it can lead to a poor user experience should these APIs change.

@johnny77221

This comment has been minimized.

Show comment Hide comment
@johnny77221

johnny77221 Apr 18, 2017

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

Owner

johnny77221 commented Apr 18, 2017

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

@shaibow

This comment has been minimized.

Show comment Hide comment
@shaibow

shaibow May 16, 2017

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

shaibow commented May 16, 2017

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

@johnny77221

This comment has been minimized.

Show comment Hide comment
@johnny77221

johnny77221 Jun 25, 2017

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

Owner

johnny77221 commented Jun 25, 2017

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

@janicechau12

This comment has been minimized.

Show comment Hide comment
@janicechau12

janicechau12 Oct 3, 2017

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?

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

This comment has been minimized.

Show comment Hide comment
@kingbin

kingbin Jan 2, 2018

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

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