iOS:13位置始终允许:点击打开的设置后,它不会重定向到应用程序设置页面
我需要打开我的应用程序设置,但有时如果我们打开了设置其他屏幕,如wifi或代理屏幕,则不会重定向到iOS 13中的应用程序设置iOS:13位置始终允许:点击打开的设置后,它不会重定向到应用程序设置页面,ios,objective-c,swift,ios13,Ios,Objective C,Swift,Ios13,我需要打开我的应用程序设置,但有时如果我们打开了设置其他屏幕,如wifi或代理屏幕,则不会重定向到iOS 13中的应用程序设置 @IBAction func openPhoneSettings(_ sender: Any) { guard let settingsUrl = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(settingsUrl) else
@IBAction func openPhoneSettings(_ sender: Any) {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString),
UIApplication.shared.canOpenURL(settingsUrl) else {
return
}
UIApplication.shared.open(settingsUrl, options: [:]) { (canOpen) in
self.dismiss(animated: false, completion: nil)
}
}
我为开放应用程序设置功能,这在任何情况下都可以重定向到应用程序设置
func openAppSetting()
{
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {return}
if UIApplication.shared.canOpenURL(settingsUrl)
{
if #available(iOS 10.0, *)
{
UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
print("Settings opened: \(success)")
})
}
else
{
UIApplication.shared.openURL(settingsUrl as URL)
}
}
else
{
print("Settings not opened")
}
}
我希望这将有助于 这在我的应用程序中运行良好,为iOS 12及更高版本构建,在模拟器和真实设备上测试
UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)
你们能更详细地描述一下你们的情况吗?你们的行为有规律吗?还是总是这样?可能使用
openURL
而不是canOpenURL