2

I have an IOS native app with Pushwoosh notifications. When I put the app in background mode (Not killed), and then received a push, methon onMessageOpened called, even the user didn’t open the push.

My onMessageOpened method:

class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate, PWMessagingDelegate {

...
...

    func pushwoosh(_ pushwoosh: Pushwoosh!, onMessageOpened message: PWMessage!) {
    
            var url = message.payload["url"] as! String
            
            let myURL = URL(string:url)
            let myRequest = URLRequest(url: myURL!)
            self.webView.load(myRequest)
        
    }
}

This is in my AppDelegate:

  func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
        Pushwoosh.sharedInstance()?.handlePushReceived(userInfo)
        completionHandler(.noData)
    }

In addition I have a difficult with debugging this issue. Because I received push only in production version. Not in debug mode.

EDIT: After I add a log calls, I can see it called to onMessageOpened just after receiving a push. You can see the low latency between records.

This is my new code:

 func pushwoosh(_ pushwoosh: Pushwoosh!, onMessageReceived message: PWMessage!) {
        NSLog("PushWoosh: message recevied!")

    }
    
    func pushwoosh(_ pushwoosh: Pushwoosh!, onMessageOpened message: PWMessage!) {
        NSLog("PushWoosh: message opened!")

            ...
        
    }

And this is my logs after a few hours of device was untouched.

enter image description here

0 Answers0