title: Push notifications via FCM server send not received by all iOS devices
body: <p>We have an issue with push notifications sent to a topic from our server. Actually, it isn't the <em>sending</em> part, it is the <em>receiving</em>. That push notifications are received by <em>some</em> iOS devices but not <em>all</em>. We haven't had issues with Android devices, we had one report regarding Android but I think that's a hoax.</p>
  
  <h1>Technical details</h1>
  
  <p>We build a request in PHP:
  </p>
  
  <pre><code>$topic = '/topics/urgent_de';
  
  $data = [
      'to' =&gt; $topic,
      'priority' =&gt; 'normal',
      'notification' =&gt; [
          'title' =&gt; $pushNotification-&gt;title_de,
          'body' =&gt; $pushNotification-&gt;text_de,
          'topic' =&gt; 'urgent',
          'target' =&gt; $pushNotification-&gt;deeplink
      ],
      'data' =&gt; [
          'title' =&gt; $pushNotification-&gt;title_de,
          'message' =&gt; $pushNotification-&gt;text_de,
          'topic' =&gt; 'urgent',
          'target' =&gt; $pushNotification-&gt;deeplink
      ]
  ];
  </code></pre>
  
  <p>Devices register on this topic using:
  </p>
  
  <pre><code>let sub:SupportedLanguage = UrlHelper.getBestSupportedLanguage() == .de ? .de : .en
  static let topicUrgent = "/topics/urgent"
  static let topicUrgentLocalizedPrefix = "urgent_"
  
  let localizedUrgent = "\(Constants.Push.topicUrgentLocalizedPrefix)\(sub.rawValue)"
  Messaging.messaging().subscribe(toTopic: localizedUrgent)
  LoggingHelper.info("Subscribed to topic: \(localizedUrgent)")
  Messaging.messaging().subscribe(toTopic: Constants.Push.topicUrgent)
  LoggingHelper.info("Subscribed to topic: \(Constants.Push.topicUrgent)")
  </code></pre>
  
  <p>This means, each device subscribes not only to a localized but also a general topic.</p>
  
  <h1>Problem description</h1>
  
  <p>We sent out a few pushes within two weeks last September and some devices in our company received them, some didn't. It didn't depend on their app or iOS version. They all have given permission to receive pushes. They were all online and running when we sent that push. None of the devices had our app in foreground. Some haven't started the app for a few weeks some had them open that same day.</p>
  
  <h1>What we already tried</h1>
  
  <ol>
  <li>We tried priority high</li>
  <li>We tried to find out how many users are affected. But reports in firebase console don't seem to include iOS devices or firebase can't track if a push was received by iOS devices (when setting filter "platform/channel" to "iOS" or "app" to "iOS app", received number is "0" but sent to several thousand) </li>
  <li>We put an iOS device which didn't receive one push on our development Macbook 
  
  <ul>
  <li>We tried to check logs but (of course) there was not output</li>
  <li>Then we deployed from XCode and sent a push to that device's token but it was received => We couldn't reproduce the issue. </li>
  <li>We then uninstalled the development version and installed app from app store. </li>
  <li>The following push was received</li>
  <li>We sent another push to topic a few months later. It wasn't received.</li>
  </ul></li>
  <li>I searched stackoverflow and other resources but I didn't find this specific issue (usually it is a problem where no pushes are received or similar)</li>
  </ol>
  
  <p>All in all, when we look at all devices in our company, only half of them receive those push notifications.</p>