pusher / push-notifications-swift

Swift SDK for the Pusher Beams product:
https://www.pusher.com/beams
MIT License
34 stars 24 forks source link

IOS 10 working with UNUserNotificationCenter? #102

Closed Dozorov closed 5 years ago

Dozorov commented 5 years ago

Hi, Pusher Notifications working with new UNUserNotificationCenter? Thx.

I triying to handle DATA when App in Background.


func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        self.pushNotifications.handleNotification(userInfo: userInfo)
        let content = userInfo
        if let aps = content["aps"] as? [String: AnyObject] {
            let requestId = aps["rid"]
            let companyName = aps["cna"]
            let request = ["request_id": requestId, "company_name": companyName]
            NotificationCenter.default.post(name: Notification.Name("RequestForAlwaysTrackingLocation"), object: nil, userInfo: request as [AnyHashable : Any])
        }
    }

It works only when app in foreground....