简体   繁体   中英

Opening Safari settings with NSURL Swift

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!

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:

在此处输入图片说明

After that use this code for open safari settings:

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

And result will be:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM