从今天 Extension/Widget 打开“设置”应用?
Open Settings app from Today Extension/Widget?
是否可以直接从 widget/today 扩展程序打开“设置”应用程序?
我试过下面的代码,但遗憾的是它不起作用
let url = URL(string:UIApplicationOpenSettingsURLString)!
extensionContext?.open(url) { _ in }
此代码应该有效
guard let url = URL(string: UIApplicationOpenSettingsURLString) else {
return
}
extensionContext?.open(url, completionHandler: { (success) in
if !success {
var responder = self as UIResponder?
while (responder != nil){
let selectorOpenURL = NSSelectorFromString("openURL:")
if responder?.responds(to: selectorOpenURL) == true {
_ = responder?.perform(selectorOpenURL, with: url)
}
responder = responder?.next
}
}
})
不过我不确定 "additional review" 是什么意思
是否可以直接从 widget/today 扩展程序打开“设置”应用程序?
我试过下面的代码,但遗憾的是它不起作用
let url = URL(string:UIApplicationOpenSettingsURLString)!
extensionContext?.open(url) { _ in }
此代码应该有效
guard let url = URL(string: UIApplicationOpenSettingsURLString) else {
return
}
extensionContext?.open(url, completionHandler: { (success) in
if !success {
var responder = self as UIResponder?
while (responder != nil){
let selectorOpenURL = NSSelectorFromString("openURL:")
if responder?.responds(to: selectorOpenURL) == true {
_ = responder?.perform(selectorOpenURL, with: url)
}
responder = responder?.next
}
}
})
不过我不确定 "additional review" 是什么意思