简体   繁体   English

如何将我的iOS应用中的用户转到“消息设置”?

[英]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. 我知道要使用的代码,但我不知道用于使用UIApplication.shared.open(URL:options :)方法创建正确URL的特定字符串文字。 I think the literal needs to start with "prefs:root=". 我认为字面量需要以“ 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". 我必须使用字符串文字“ App-Prefs:root = MESSAGES”。

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

Will open Settings->Messages 将打开设置->消息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS设置-通知:如果我不使用本地通知,如何删除我的应用程序? - iOS Settings - Notifications: How to remove my App if I do not use local notifications? 如何在iPhone应用程序中创建用户登录名,密码以及在用户之间交换消息的功能 - How do I create a user login, password and ability to exchange messages between users in my iphone app 如何通过Cordova项目向iOS应用正确添加设置? - How do I properly add settings to an iOS app with a Cordova project? 如何在iOS应用中向用户展示设置? - How to present settings to the user in an iOS app? 当用户点击应用中的任何链接时,如何阻止我的ios应用打开网址? - How do i stop my ios app from opening a url when user taps on any link in the app? iOS如何将用户直接带到钱包应用程序 - iOS how to take user directly to the Wallet app 如何在我的iPhone应用程序中进行信用卡订阅? - How do I take a credit card subscription in my iPhone app? 当用户在iOS中删除我的应用时,我可以做什么? - Can I do something when user deletes my app in iOS? 当用户单击“主页”按钮时,如何重置我的iOS应用? - How do I make my iOS app reset when the user clicks the home button? 如何将ios应用程序集成到iOS消息照片查看器中的“共享”窗格中? - How can I integrate my ios app into the “Share out” pane in the iOS messages photo viewer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM