Swift iOS 10 didReceiveRemoteNotification only pops notification ignores other command -


my intention pretty straight forward:

  1. receive remote notification
  2. send local notification user
  3. update local database new data
  4. tell server data received

    func application(_ application: uiapplication, didreceiveremotenotification userinfo: [anyhashable : any], fetchcompletionhandler completionhandler: @escaping (uibackgroundfetchresult) -> void) {     // receiption code here     nslog("received remotely:: \(userinfo)")      let content = unmutablenotificationcontent()         content.body = message.body()         content.title = message.body()         content.subtitle = "new message"         content.sound = unnotificationsound.default()         content.badge = nsnumber(value:uiapplication.shared.applicationiconbadgenumber+1)      let trigger = untimeintervalnotificationtrigger(timeinterval: 1, repeats: false)      let request = unnotificationrequest(identifier: message.thread(), content: content, trigger: trigger)      let center = unusernotificationcenter.current()     center.add(request)   dispatchqueue.global(qos: .background).async { [weak self]         () -> void in      if !(self?.xmppstream?.isconnected())! {         let _ = self?.connect()     }else{         xmppstream.send(receptionmessage)     }  } 

    but happens local notification sent, thats it. other commands executed on app resume.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -