25

I'm using Google Firebase Cloud Messaging API (FCM) to send push notifications to my iOS app. I could get push-notifications working successfully when I test the app on a device with Development provisioning profiles + development push notification(sandbox) certificates.

However I'm unable to get it working on production environment. I made an ad-hoc build with correct production provisioning profiles and production push notification certificates. And synced an IPA file to a device via iTunes for testing (not directly from xcode). Still I can't receive push notifications from firebase console.

I have uploaded correct development and production certificates (with private keys) to firebase as well. I've double checked every possible step that could go wrong but, still can't find the issue. Is there a way to troubleshoot this issue? Or isn't it possible to get production environment notifications to an AdHoc build?

Rukshan
  • 7,902
  • 6
  • 43
  • 61
  • please explain why downvoted? – Rukshan Aug 19 '16 at 08:26
  • Did you send your device token to Firebase? – iSashok Aug 19 '16 at 08:28
  • I mean did you call this method `[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd];`? – iSashok Aug 19 '16 at 08:30
  • 1
    I have not set `FirebaseAppDelegateProxyEnabled` to `NO` to call that method. But I tried this method as well. It didn't work. – Rukshan Aug 19 '16 at 08:35
  • I have no idea why someone downvoted this. I am having a similar problem. However, in production, sometimes the push is delivered and other times the push doesn't reach the device :/ – Tiago Almeida Aug 26 '16 at 09:38
  • @TiagoAlmeida Have you tested production version with an ad-hoc IPA file? or were you able test what happens when the same IPA is downloaded from app store? I suspect production push notifications are not delivered to ad-hoc builds but it might work once it downloaded from App Store. I couldn't test this yet. – Rukshan Aug 26 '16 at 10:40
  • 1
    I did even better! I tested with an external build from testflight ;) – Tiago Almeida Aug 26 '16 at 10:41
  • I'm going to submit a build to App Store and see how it goes. Hope production push notifications will work with an app store version. If not, I'm out of clues :/ – Rukshan Aug 26 '16 at 10:49
  • Testflight is the closest you can get to a production environment. In my case ,it is not working in testflight (I receive a push from time to time but not every pushs are delivered). Other builds with dev are working :/ – Tiago Almeida Aug 26 '16 at 11:14
  • @TiagoAlmeida did you find a solution for this yet? – Rukshan Oct 26 '16 at 11:20
  • @sleepwalkerfx Dude any luck? I am in same situation. Push not working for Production builds. Also not using `FirebaseAppDelegateProxyEnabled` .. Have u got an solution? – Hyder Jan 13 '17 at 09:24

4 Answers4

20

I had the same issue. Apparently there is an error in the Firebase documentation. When you exporting the APN certificate for production from your keychain to the .p12 file you have to select the actual certificate, not the private key.

Make sure you upload to the Firebase console this .p12 file in the Cloud Messaging APN certificate settings.

andrew_b
  • 721
  • 5
  • 7
  • After countless hours of trying new app builds, this solved my problem! Thank you! – JFed8 Feb 13 '17 at 18:42
  • This should included in the documentation. Lost several hours on this – Rakitha Mar 14 '17 at 07:08
  • It's not giving me the option to create a signing request when I right click on the certificate. That option only appears if I select the private key. Am I missing something? – BossGiveMeArrays Mar 17 '17 at 11:24
  • It's unbelievable that Google still hasn't corrected this. @BossGiveMeArrays you have to export the certificate after you have generated it and dowloaded it to your computer – Revolutionair Apr 10 '17 at 09:50
1

Had same issue. Finally got it working by:

  1. Using the correct Project and Target Build Settings as mentioned in This link.

  2. And revoking the existing push certificates and creating a new one completely, and then uploading the new certificate's .p12 file to the Firebase Console.

Hyder
  • 1,163
  • 2
  • 13
  • 37
0

What fixed my issue was using the new Authentication Keys method instead of the old p12 files. You can read more in the Firebase documentation, just follow their steps and you should be fine.

damjandd
  • 708
  • 2
  • 9
  • 24
0

I had the same issue.

What helped me: adding APNS for Distribution Certificate to Firebase. Simple as that ;)