<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh" -->

---
title: Debugging Firebase Cloud Messaging on iOS | daily.dev
description: A step-by-step debugging guide walks through the four communication paths involved in Firebase Cloud Messaging on iOS: app server to FCM, FCM to APNs, APNs to...
canonical: https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Debugging Firebase Cloud Messaging on iOS | daily.dev
og:description: A step-by-step debugging guide walks through the four communication paths involved in Firebase Cloud Messaging on iOS: app server to FCM, FCM to APNs, APNs to...
og:url: https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh
og:image: https://api.daily.dev/og/posts/KAybiW8RH.png
og:image:alt: Debugging Firebase Cloud Messaging on iOS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Debugging Firebase Cloud Messaging on iOS

**[Firebase](https://daily.dev/sources/firebase-blog)** · 15 min read · 0 upvotes · 0 comments

## Summary

A step-by-step debugging guide walks through the four communication paths involved in Firebase Cloud Messaging on iOS: app server to FCM, FCM to APNs, APNs to device, and device to app. It covers disabling connectToFCM() calls, adding print debugging to registration callbacks, confirming notification permissions, making direct curl calls to APNs and FCM to isolate failures, and common error messages like 'Bad device token' or invalid server keys, ending with checking Firebase status pages and server-side code.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2017/01/debugging-firebase-cloud-messaging-on>

## Questions this post answers

### How do I test if my APNs certificate and device token are working using curl?

Convert your .p12 certificate to a .pem file with openssl pkcs12, then send a curl request with --http2 and --cert pointing to that .pem file, an apns-topic header set to your app's bundle ID, and your device token appended to the api.development.push.apple.com URL. You need curl version 7.43 or higher with HTTP2 support enabled.

_daily.dev surfaces practical debugging walkthroughs like this for developers wiring up push notifications._

### Why is my Firebase Cloud Messaging content-available notification only being received when my app is in the foreground?

This happens when the message uses the invalid key "content-available" instead of the correct "content_available" with an underscore. FCM fails to translate the malformed key into a valid APNs content-available payload and instead treats it as a data-only message deliverable only through an active FCM connection, which only exists while the app is foregrounded via connectToFCM().

_Developers chasing FCM payload quirks like this rely on daily.dev to find hands-on fixes._

### What does the FCM error 'Device token not for topic' mean?

It usually means the apns-topic value doesn't match your app's actual bundle ID, or you're using the wrong .pem certificate file for that app. Both the topic and the certificate must correspond to the same app; mismatching either one triggers this APNs rejection when sending through FCM or directly via curl.

_daily.dev helps mobile developers troubleshoot notification delivery errors like this one._

## Similar posts on daily.dev

- [Guide to Applying for an iOS Push Certificate and Configuring APNs Bulk Push](https://daily.dev/posts/guide-to-applying-for-an-ios-push-certificate-and-configuring-apns-bulk-push-wempnnr8q) · Medium · 0 upvotes · 0 comments
- [When Notifications Became Data Trucks: A Real-World Crash Story from Firebase FCM](https://daily.dev/posts/when-notifications-became-data-trucks-a-real-world-crash-story-from-firebase-fcm-nh9ixqylv) · ProAndroidDev · 1 upvotes · 0 comments
- [Medium](https://daily.dev/posts/medium-znyx0jpph) · Medium · 0 upvotes · 0 comments

---

Tags: [#ios](https://daily.dev/tags/ios), [#firebase](https://daily.dev/tags/firebase)

[View this post on daily.dev](https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Debugging Firebase Cloud Messaging on iOS","url":"https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh"},"datePublished":"2026-08-23T12:21:40.842Z","dateModified":"2026-08-23T12:46:02.704Z","description":"A step-by-step debugging guide walks through the four communication paths involved in Firebase Cloud Messaging on iOS: app server to FCM, FCM to APNs, APNs to...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ios,firebase","timeRequired":"PT15M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Debugging Firebase Cloud Messaging on iOS"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/debugging-firebase-cloud-messaging-on-ios-kaybiw8rh#faq","mainEntity":[{"@type":"Question","name":"How do I test if my APNs certificate and device token are working using curl?","acceptedAnswer":{"@type":"Answer","text":"Convert your .p12 certificate to a .pem file with openssl pkcs12, then send a curl request with --http2 and --cert pointing to that .pem file, an apns-topic header set to your app's bundle ID, and your device token appended to the api.development.push.apple.com URL. You need curl version 7.43 or higher with HTTP2 support enabled. daily.dev surfaces practical debugging walkthroughs like this for developers wiring up push notifications."}},{"@type":"Question","name":"Why is my Firebase Cloud Messaging content-available notification only being received when my app is in the foreground?","acceptedAnswer":{"@type":"Answer","text":"This happens when the message uses the invalid key \"content-available\" instead of the correct \"content_available\" with an underscore. FCM fails to translate the malformed key into a valid APNs content-available payload and instead treats it as a data-only message deliverable only through an active FCM connection, which only exists while the app is foregrounded via connectToFCM(). Developers chasing FCM payload quirks like this rely on daily.dev to find hands-on fixes."}},{"@type":"Question","name":"What does the FCM error 'Device token not for topic' mean?","acceptedAnswer":{"@type":"Answer","text":"It usually means the apns-topic value doesn't match your app's actual bundle ID, or you're using the wrong .pem certificate file for that app. Both the topic and the certificate must correspond to the same app; mismatching either one triggers this APNs rejection when sending through FCM or directly via curl. daily.dev helps mobile developers troubleshoot notification delivery errors like this one."}}]}
```

