1

Is it possible to open Safari app settings using NSURL link ?

Here is the code i'm using for general settings

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

How should i modify it - if its even possible?

Thank you!

David Robertson
  • 1,561
  • 4
  • 19
  • 41

2 Answers2

2

I have found this post: Call the official *Settings* app from my app on iPhone

From that post follow this two steps:

First go to Info -> URL Types and add URL Schemes as prefs as shown in below image:

enter image description here

After that use this code for open safari settings:

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

And result will be:

enter image description here

Community
  • 1
  • 1
Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165
0

As of iOS 16, should be

Link("Setting Safari", destination: URL(string: "App-Prefs:Safari")!)

And we can even goto the subpages with an &path=WEB_EXTENSIONS

Link("Setting Safari", destination: URL(string: "App-Prefs:Safari&path=WEB_EXTENSIONS")!)

Also if you want goto somewhere else in the settings, it is also possible:

taking Apple ID page as an example:

Link("iCloud Account", destination: URL(string: "App-prefs:APPLE_ACCOUNT")!)

BTW, on our app, the review passed.

enter image description here

see github repo for more examples.

kakaiikaka
  • 3,530
  • 13
  • 19