title: Not receiving push notifications if sending "data" (but "notification" works) payloads to GCM/FCM in iOS didReceiveRemoteNotification
body: <p>I am trying to get "data" payload notifications to be received for our iOS app.</p>
  
  <p>Today we can send GCM <code>notification</code> push notifications as according to:</p>
  
  <p><a href="https://developers.google.com/cloud-messaging/concept-options" rel="noreferrer">https://developers.google.com/cloud-messaging/concept-options</a></p>
  
  <p>(FCM has the same text)</p>
  
  <p>An easy test is using CURL:</p>
  
  <pre><code>curl -X POST \
    https://gcm-http.googleapis.com/gcm/send \
    -H 'authorization: key=##_GCM_SERVER_ID_##' \
    -H 'cache-control: no-cache' \
    -H 'content-type: application/json' \
    -H 'postman-token: ##_POSTMAN_TOKEN_##' \
    -d '{
      "notification": {
          "body": "Test body"
      },
      "to" : "##_DEVICE_TOKEN_##"
  }
  '
  </code></pre>
  
  <p>This will successfully trigger iOS <code>AppDelegate.didReceiveRemoteNotification:fetchCompletionHandler</code> function.</p>
  
  <p>However, if change it to a <code>data</code> notification:</p>
  
  <pre><code>curl -X POST \
    https://gcm-http.googleapis.com/gcm/send \
    -H 'authorization: key=##_GCM_SERVER_ID_##' \
    -H 'cache-control: no-cache' \
    -H 'content-type: application/json' \
    -H 'postman-token: ##_POSTMAN_TOKEN_##' \
    -d '{
      "data": {
          "body": "Test body"
      },
      "to" : "##_DEVICE_TOKEN_##"
  }
  '
  </code></pre>
  
  <p>I can't see anything is being sent to the app from GCM (in either <code>didReceiveRemoteNotification</code> functions), even if the app is in background/foreground.</p>
  
  <p>Even though it says in the documentation it should:</p>
  
  <p><a href="https://developers.google.com/cloud-messaging/concept-options#notifications_and_data_messages" rel="noreferrer">https://developers.google.com/cloud-messaging/concept-options#notifications_and_data_messages</a></p>
  
  <blockquote>
    <p>Note these further platform-specific details:</p>
    
    <ul>
    <li>On Android, data payload can be retrieved in the Intent used to launch your activity.</li>
    <li>On iOS, data payload will be found in didReceiveRemoteNotification:.</li>
    </ul>
  </blockquote>
  
  <p>GCM can handle pure <code>data</code> push notifications to the APN network right?</p>
  
  <p>Do I need to do anything special to receive <code>data</code>, compared to <code>notification</code>, Push Notifications in iOS? </p>