Closed aml25 closed 4 years ago
I will report back if I see any other issues, but I'm closing this for now as I think I resolved it. Here's what I did:
phonegap-plugin-push
with no success (although Android worked fine), I decided to revoke all my certificates and keys from https://www.developer.apple.com and reestablish them - since I did this before I now knew a bit more about it and could do it my systematically.Configuration with auth keys is recommended as they are the more current method for sending notifications to iOS
, I created an APNs certificate by going to Identifiers
, opening my app, scrolling down to Push Notifications
(which should be enabled at this point, if not, enabling it will force you to recreate some certificates again) and click on Configure
or Edit
in the right column. I added both dev and prod APNs certificates..p12
file to upload to Firebase. To do so, just right click on the certificates you created in the previous step in Keychain and click export. Don't make the mistake of expanding the dropdown and exporting from the key there, that won't work, you need to export from the certificate.I edited a ton of other stuff before getting to this point so if you still can't get it working let me know, I might have tried something you didn't. Like, adding this to config.xml
in the ios
platform section:
<config-file target="*-Info.plist" parent="UIBackgroundModes">
<array>
<string>remote-notification</string>
</array>
</config-file>
I'm actually using https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated, but they appear to have issues turned off. Since it's a fork I figured I'd post this here.
I'm using
Cordova 9.0.0 (cordova-lib@9.0.1)
andandroid 8.1.0
andios 5.1.1
. I'm not using Ionic, just plain Cordova.Android notifications work fine, background and foreground, but I'm experiencing random behavior on iOS. It appears sometimes notifications (background) work and sometimes they don't. Meaning, one on (physical) device running from XCode will work but then uninstalling the app and re-running will randomly stop working. It will also run on an iPhone but not on an iPad - at the same randomness. It seems to get better if I remove all platforms and the FCM plugin and reinstall, but it's not fullproof.
I'm using the Cloud Messaging interface to send the messages to test devices (via FCM Token) but have also tried with https://cordova-plugin-fcm.appspot.com/ using the payloads outlined in
README.md
Here's what I've learned so far. I can predict when background notifications will work when a foreground notification prints this in XCode terminal:
I can predict background notifications will not work when XCode terminal prints this from a foreground notification
^ The above 2 printouts are literally from the same device, exact same code, but going from running from XCode to device, then uninstalling from device, then running again to the same device all within a couple minutes.
This randomness is consistent from day to day and I can't seem to get it stable. I realize there's a lot of info out there on this issue but I haven't come across these 2 different printouts from XCode so thought it either might help troubleshoot or someone has seen this before and has an idea how to fix it.