ios – Get notification after applicationWillEnterForeground


I am making an attempt to get a push notification despatched from server when consumer has my software in background, or closed and the notification got here from server.
Consumer clicks the push notification bar and the applying opens.
This works, however I am undecided tips on how to get the notification object to make it seen and depend down badges.

I attempted so as to add observer in my mainviewcontroller

NotificationCenter.default.addObserver(
              self,
              selector: #selector(applicationWillEnterForeground(_:)),
              identify: UIApplication.willEnterForegroundNotification,
              object: nil)

I attempted so as to add code to my AppDelegate

func applicationWillEnterForeground(_ software: UIApplication) {
        print(">>>>applicationWillEnterForeground;AppDelegate")
    }

This two blocks are responding, however I am undecided tips on how to entry clicked notification object

See also  swift - IOS: AppleLanguages not taking impact after app restart (typically)

Leave a Reply