简体   繁体   中英

How do I take the user in my iOS app to the Messages Settings?

How would I take the user from my app to the Messages Settings? I know the code to use, but I don't know the specific string literal to create the correct URL with to the UIApplication.shared.open(URL:options:) method with. I think the literal needs to start with "prefs:root=". It needs to be something like the following. I just need to know what literal to use instead of "Messages".

    let urlString = "prefs:root=Messages"  

    let url = URL(string: urlString)!  

    let options: [String: Any] = [:]  
    UIApplication.shared.open(url, options: options) {  

        bool in  

        print(bool)  

    }  

I figured it out. I have to use the string literal "App-Prefs:root=MESSAGES".

let url = URL(string: "prefs:root=MESSAGES")!
UIApplication.shared.openURL(url)

Will open Settings->Messages

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