0

I would like my custom made app to be able to open the iOS native settings page, specifically the settings for installing new voices to your device.

How can I do this in Objective C?

I saw you can use UIApplicationOpenSettingsURLString to open the settings, but I need to go to the specific install voices settings page for the current language of the user which looks like this:

Install Voices Settings Page for Dutch

This page is found under: Settings -> Accessibility -> Spoken Content -> Voices -> (Your Language)

Getting to the Voices page, where the user has to select the language is fine too.

I guess I could try using the open() objective C function in order to open a custom URI scheme, but I need to know which URI scheme I need exactly...

EDIT: This is what I'm currently trying to do:

    NSString *voiceSettings = @"prefs:root=ACCESSIBILITY&path=SPEECH_TITLE#QuickSpeakAccents";
    NSString *cleanQuery = [voiceSettings stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: [NSString stringWithFormat:cleanQuery]] options:@{} completionHandler:nil];

However it fails with:

Failed to open URL prefs:root=ACCESSIBILITY&path=SPEECH_TITLE#QuickSpeakAccents: Error Domain=NSOSStatusErrorDomain Code=-10814 "(null)" UserInfo={_LSLine=229, _LSFunction=-[_LSDOpenClient openURL:options:completionHandler:]}

am I missing something here?

SimbaClaws
  • 1,389
  • 2
  • 9
  • 13
  • See https://gist.github.com/deanlyoung/368e274945a6929e0ea77c4eca345560 try replacing `prefs` with `App-prefs` and see how it goes. – skaak Apr 02 '21 at 14:22
  • Due to Gereon's answer I think the only alternative I can think off without rejection would be creating a dialog screen that shows the steps to get to the voice install page. Which I honestly find quite ridiculous and counter intuitive. – SimbaClaws Apr 02 '21 at 14:27

1 Answers1

0

UIApplicationOpenSettingsURLString is the only supported way of opening the built-in Settings.app. Any other method is a hack and runs the risk of review rejection because of private API usage.

See e.g. Is it considered a private API to use App-prefs:root?

Gereon
  • 17,258
  • 4
  • 42
  • 73
  • Hmmm so apple does not support opening any other page inside settings externally otherwise your app will be rejected? How is this user friendly? Or can I open other pages inside Settings.app using UIApplicationOpenSettingsURLString? – SimbaClaws Apr 02 '21 at 13:44
  • Why is this not mentioned anywhere in the documentation?https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899 or https://developer.apple.com/documentation/uikit/uiapplication/1648685-open Doesn't tell me anything either. There is no such mention in the documentation about opening system URI schemes. Or how one would open a system app page. – SimbaClaws Apr 02 '21 at 13:56
  • AFAIK there is no "legal" way to open anything in Settings besides what `UIApplicationOpenSettingsURLString` does. This has been Apple's policy for a long time, and there's not much you can do about that besides filing an enhancement request. – Gereon Apr 02 '21 at 15:37