Firebase Cloud Messaging Trouble: Exporting .p12 for Certification…A Very Simple Mistake

Push notification not working… The reason of the trouble always simple mistake. At this time I made very simple and probably I will do again. So, I record the shooting point.
In this case I use Firebase. (I lost about 16 hours.) This solution may not support other services.

Check Point 1: Certificates, Provisioning Profile

  • Check expiration of Certification
  • Check Provisioning Profile both Developer, and Distribution.

Revoking Certification, Deleting Provisioning Profile, these operations don’t related with working application or App Store distribution. However take care risk of Revoke to Certification. If renew Certificate or Provisioning Profile, you have to submit again only the Push Notification Trouble Shooting.

Check Point 2: Application library, Programming codes

  • Push Notification only received real devices. Simulator testing cannot receive any notification.
  • But Simulator testing can check Server communication with all Log and debug action.

This time Missing Point

Only Select Encryption Key to Export .p12 files on Key Chain Mac Application, WITHOUT Select Certification.
p12export

It looks success and nothing errors in Firebase Console when uploaded p12 file to Firebase by Certification and Encryption Key selected exporting one.
Probably Password is correct, extraction is ready, but file cannot load correctly.
firebase


プッシュ通知が届かない…この手のトラブルは、単純なミスが多いのですが、今回、ひさしぶりに笑ってしまいそうで、またやってしまいそうなミスをしたので、残しておきます。今回の環境は、Firebaseでした。(16時間は費やしました…)違う環境では、不適切かもしれませんが。

チェックのポイント1:Certificates, Provisioning Profile

  • Certificationの有効期限は問題ない。
  • Provisioning Profileは、Developer、Distributionのいずれで適切にセットしている。

CertificationやProvisioning ProfileをRevoke, Deleteしても、すでに稼働しているアプリケーションが動かなくなったり、App Storeからの配布に影響が出ることはないが、古いCertificateをRevokeするリスクは十分に検討すること。稼働環境のプッシュ通知が、どのCertificateとProvisioning Profileで稼働しているかを意識しておかないと、プッシュ通知のためだけにApplicationを再申請することになる。

チェックのポイント2:Applicationのライブラリ、コード

  • プッシュ通知の受信表示は実機でしか届かない。
  • Simulatorでの作業でも、サーバーとの通信状況をログで確認することは可能。

今回、無駄な時間を費やしたミス

キーチェーンから.p12などで証明書を書き出す際、書き出すのは「秘密鍵」のみを選択。証明書を選択しない。
p12export

Firebaseにp12ファイルをアップロードした際に、証明書と秘密鍵をいっしょに暗号化したファイルでも、コンソール上は何の問題も出ませんでした。
パスワードが一致して、展開されたが、ファイルがおかしい…という状態に陥っていたようです。
firebase