zhuguoming

设置跳转修改

... ... @@ -42,17 +42,20 @@ public class FlutterPushPlugin: NSObject, FlutterPlugin {
}
case "getPermission":
print("getPermission跳转设置获取权限")
if #available(iOS 15.0, *) {
// iOS 15 及以上版本,直接跳转到通知设置页面
if let url = URL(string: "App-Prefs:NOTIFICATIONS_ID") {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
} else {
// iOS 15 以下版本,跳转到应用的设置页面
if let url = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
// if #available(iOS 15.0, *) {
// // iOS 15 及以上版本,直接跳转到通知设置页面
// if let url = URL(string: "App-Prefs:NOTIFICATIONS_ID") {
// UIApplication.shared.open(url, options: [:], completionHandler: nil)
// }
// } else {
// // iOS 15 以下版本,跳转到应用的设置页面
// if let url = URL(string: UIApplication.openSettingsURLString) {
// UIApplication.shared.open(url, options: [:], completionHandler: nil)
// }
// }
result(true)
default:
result(FlutterMethodNotImplemented)
... ...