如何将iOS应用程序中的用户添加到消息设置中?
问题描述:
我该如何将用户从我的应用程序转到邮件设置?我知道要使用的代码,但我不知道具体的字符串字面值,以与UIApplication.shared.open(URL:options :)方法一起创建正确的URL。我认为文字需要以“prefs:root =”开头。它需要如下所示。我只需要知道使用什么文字而不是“消息”。如何将iOS应用程序中的用户添加到消息设置中?
let urlString = "prefs:root=Messages"
let url = URL(string: urlString)!
let options: [String: Any] = [:]
UIApplication.shared.open(url, options: options) {
bool in
print(bool)
}
答
我想通了。我必须使用字符串文字“App-Prefs:root = MESSAGES”。
答
let url = URL(string: "prefs:root=MESSAGES")!
UIApplication.shared.openURL(url)
将打开设置 - >信息
我已经试过了。直到我将字符串文字更改为“App-Prefs:root = MESSAGES”,它才起作用。我不知道为什么。我发现文档说的是你说的同样的东西。 – ShinehahGnolaum