Swift3 用户启用推送通知设置页面后,如何在该页面中来回导航

Swift3 用户启用推送通知设置页面后,如何在该页面中来回导航,swift3,Swift3,我使用下面的代码来检测用户是否启用了推送通知 **Problem**. 1) How to open or navigate to the Push Notification setting Page in the phone 2) How to return from this Push Notification page after user enabled it or how user return to previous page if decide to enable later

我使用下面的代码来检测用户是否启用了推送通知

**Problem**.
1) How to open or navigate to the Push Notification setting Page in the phone
2) How to return from this Push Notification page after user enabled it or
   how user return to previous page if decide to enable later.

VC_Check  -->  Push Notification settings 

in VC_check:

if UIApplication.shared.isRegisteredForRemoteNotifications {
            print("YES")

    // goto other VC

  } else {

   // goto Phone setting page

  }


//-- I dont want this Pop Up to enable Push Notification:

// detected not enabled, use below pop Up

pageUIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound, .alert], categories: nil))
    UIApplication.shared.registerForRemoteNotifications()
请帮忙


谢谢

您可以这样请求启用推送通知:

func requestNotificationPermission() {
        let app = UIApplication.shared

        // --- from right here
        if #available(iOS 10.0, *) {
            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })

            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.current().delegate = self
            // For iOS 10 data message (sent via FCM)

        } else {
            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
            app.registerUserNotificationSettings(settings)
        }
        app.registerForRemoteNotifications()
        if #available(iOS 10.0, *) {
            let center = UNUserNotificationCenter.current()
            center.requestAuthorization(options:[.badge, .alert, .sound]) { (granted, error) in
                // Enable or disable features based on authorization.
                // DO SOMETHING HERE AFTER USER AUTHORIZES, CALL A FUNCTION TO RELOAD VIEW?
            }
            app.registerForRemoteNotifications()
        } else {
            // Fallback on earlier versions

        }
  }
要检查用户是否已授予权限,请使用以下命令:

func checkNotificationStatus() {
        let current = UNUserNotificationCenter.current()

        current.getNotificationSettings(completionHandler: { (settings) in
            if settings.authorizationStatus == .notDetermined {
                // Notification permission has not been asked yet, go for it!
                print("Not yet asked for permission")
            }

            if settings.authorizationStatus == .denied {
                // Notification permission was previously denied, go to settings & privacy to re-enable
                print("Permission denied")
            }

            if settings.authorizationStatus == .authorized {
                // Notification permission was already granted
                print("Permission Granted")

            }
        })
    }