title: Firebase Notification with Push Kit in iOS
body: <p>I'm making a voip application, in which I'm using firebase notification to make user aware of incoming call. Firebase notification is hit from our server, they have integrated firebase with them. For incoming call notification when app is in background or kill state I have used Push kit delegate. Now when my application is in background or terminated condition iIreceive a normal push notification in firebase delegates. I want to get this notification payload in Push Kit delegate which is currently I'm not getting. How I can get that? I have implemented all the required stuff for Push Kit and on background modes and voip services, but it isn't working. Can anyone tell me how I can get my firebase notification in Push Kit delegate? This is my code for push kit,</p>
  
  <pre><code>let mainQueue = DispatchQueue.main
      let voipRegistry: PKPushRegistry = PKPushRegistry(queue: mainQueue)
      voipRegistry.delegate = self
      voipRegistry.desiredPushTypes = [PKPushType.voIP]
  
  
  extension AppDelegate: PKPushRegistryDelegate {
  func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials: PKPushCredentials, for type: PKPushType) {
      let token = pushCredentials.token.map { String(format: "%02.2hhx", $0) }.joined()
      NSLog("voip token: \(token)")
      UserDefaults.standard.set(token, forKey: Key_Push_token)
      UserDefaults.standard.synchronize()
  }
  
  
  func pushRegistry(registry: PKPushRegistry!, didUpdatePushCredentials credentials: PKPushCredentials!, forType type: String!) {
  
      //print out the VoIP token. We will use this to test the notification.
      let token = credentials.token.map { String(format: "%02.2hhx", $0) }.joined()
      NSLog("voip token: \(token)")
  }
  
  private func pushRegistry(registry: PKPushRegistry!, didReceiveIncomingPushWithPayload payload: PKPushPayload!, forType type: String!) {
  
      userInfo = payload.dictionaryPayload["aps"] as? [AnyHashable:Any]
  
      print(userInfo!)
      let payloadDict = payload.dictionaryPayload["aps"] as? Dictionary&lt;String, String&gt;
      let message = payloadDict?["alert"]
      print(message!)
  
      //present a local notifcation to visually see when we are recieving a VoIP Notification
      if UIApplication.shared.applicationState == UIApplicationState.background {
          print("Background")
      }
  
      else {
  
      }
  
      NSLog("incoming voip notfication: \(payload.dictionaryPayload)")
  }
  
  private func pushRegistry(registry: PKPushRegistry!, didInvalidatePushTokenForType type: String!) {
  
      NSLog("token invalidated")
  }
  }
  </code></pre>
  
  <p>This is the token I send to my server side to hit notification on this token, <code>NSLog("voip token: \(token)")</code>, but I'm not getting any notification.</p>