Firebase Cloud Messaging Push Notificartions don't arrive on iOS anymore - ios

I have a problem with Firebase Cloud Messaging on iOS. I have implemented Firebase into the app like stated in the docs and a Firebase instance id is generated. However, if I try to send a push notification (for example using http://pushtry.com/), nothing happened. The thing is, it did work, and I don't remember changing anything to do with notifications.
Because I couldn't find anything, I even tried deleting the whole project and doing everything again from scratch (by copying the code). Then it worked again, but now (an hour later) again, it again doesn't work.
If I send a FCM from pushtry or from the Firebase Console, it says the message is delivered, but nothing happens! (Push notifications are enabled in the iOS Settings. It did work)
I really don't know what to do. Does anybody know about anything I could do?
Thank you in advance.

Okay after two whole days of utmost frustration, I figured it out.
The problem was the line FirebaseAppDelegateProxyEnabled set to NO in the info.plist file.
After I removed the line, the problem was gone!
I am so relieved right now

set parameter content_available to true

In my case, I had migrated my Apple account and forgot to configure both my Apple and Firebase account correctly.
Apple side
Make sure that "Push Notification" is enabled for that app id.
Make sure that you had created "Apple Push Notification service" certificate and attached to the Apple Id.
Create an Authorization Key that will be later updated load Firebase so it can communicate with Apple servers in your behalf. (link)
Firebase side
Make sure your iOS apple bundle is set correctly in your Firebase project
Upload the Authorization key you created before in Apple - Step 3 above. (link)
Follow all the steps to have the iOS app integrated with Firebase SDK
That is it.

Related

FireBase Test Not Sending Notifications

I am working with a Vanilla React Native project that uses Expo Modules (NOT built on Expo) and I am trying to hook up Firebase Push Notifications. I followed the instructions here and it seems like everything should be working. I get the Firebase Token as expected, and there are no firebase errors in the console. The Notifications Permissions pop up appears when I run it on an emulator, letting me know that it's properly configured on Apple's side of things.
The kicker is that I had everything working, but I needed to create a new Firebase project because I changed the App's Bundler ID. Since you cannot edit the Firebase Projects' Bundler ID's, I had to start a new project on
Firebase, but all of the code in my Podfile, AppDelegate, and other files in the code base was already there and did not need to be changed in any way. The only thing code-wise to be changed was the GoogleService-Info.plist file that Firebase provides.
However, when I extract the FCM Token and use it in the Firebase Cloud Messaging Test page, (shown below) nothing happens when I send the test message.
What can I do to try to fix this? I've gone over the steps again and again, making sure I have the proper Apple Key, Provisioning Profile, and Certificate, and that they've been properly uploaded to Firebase. I've also checked inside of Xcode to make sure that Push Notifications and Background Services were enabled, and they both were.

Flutter/ios: Cant get firebase messaging to work

Im making a flutter caht app, and im trying to get push notifications to work. It works on Android, so I know the code I have is working fine: it is something specific with android. I followed firebase's steps closely, to list what I have so far:
Xcode capabilities:
app bundle id is for sure the same between ios and firestore
APN authentication key setup with team value and app key
Anything Im missing? Really no idea what it could be.
Few things you can check
Add the apns key in firebase
Use a real device
Enable push notification capability in xcode
Check the app in different state. Background, killed, foreground
I found the solution for me was that I was trying to implement both an APN auth key, and APN certificate. When i changed my app through app store connect to only the auth key, it worked.
I also used a real device to test.

IOS firebase connection stuck on 'Run your app to verify installation'

I'm working on a Flutter application on both iOS and Android, for this I need to use notifications and I made it work on android successfully after some hard part ( flutter clean FTW ).
I now wanted to do the same for iOS and I have problems connecting the app to the firebase backend, I followed step by step the Tutorial on the firebase_messaging pub.dev but I can't get it to connect on the 5th and last task on the the firebase backend. It's stuck on 'Run your app to verify installation, you might need to uninstall and reinstall it again'.
Of course I downloaded the GoogleService-Info.plist and put it next to info.plist and I've added the FirebaseAppDelegateProxyEnabled key as well as this code in the AppDelegate :
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
I also made sure to activate the push notifications and background modes capabilities on Xcode.
But somehow it still doesn't work at all and stuck on the same message, yet I can use the firebase tool to get the user Token for example ?!?!
I also made the call so that the user enable the app to get notifications.
Here's my flutter doctor :
Can anyone help me with this? I found a lot of issues on GitHub for this but no clear answer have been given yet. I don't have any error message or really anything more that could help identify what's wrong there.
Thanks a lot in advance
So, after a lot of time i finnaly did get notifications on my IOs device, since i had the firebase Token of the Iphone, i managed to send a notification to this deveice even thought it still isn't connected to the firebase backend.

Why the Flutter phone authentication won't work my real device

I have encountered a strange problem. I'm using the Flutter tool to create my iOS app which requires Firebase phone authentication. I was able to make it work on the other app platform without any fuss, but I'm not able to make it work on iOS real device. As per the documentation, I have to register an APN key from the developer account which I did and added my app's bundle ID too. This key I had to upload in my app console in Firebase which I also did. The REVERSE_CLIENT_ID was entered in the project settings in Xcode too, so the simulator version works flawlessly.
However, when it came to make it work on the real iPhone, I get this issue
flutter: exception code verifyPhoneNumberError message Invalid token.
I just am not able to make out what the issue is. One thing to note is that I had created a native Swift version using same APN key with different App ID for test purpose. Could this be a cause? Should I create a new APN key and will that allow my old App ID?
I got it working by doing a couple of things. I don't really know which one is the actual reason of it working, but along with official docs, I also followed this blog post https://medium.com/flutter-community/flutter-adding-sign-in-with-google-and-phone-authentication-to-your-app-69f681518f9b for help and achieved it due to the blogger's additional help when asked.
Basically I created a new APN key altogether for both push notifications and Firebase phone authentication, then uploaded in Firebase console (removing my old one). Later, the blogger suggested I also enable Background modes for remote notifications in my Xcode project settings. I didn't know this, as I had thought the Push Notifications switch was enough. Anyhow, bam! it started working.

Attempting to sent Push Notifications to iOS device - not receiving them

I have so far done the following:
- Generated certificate and private key as .pem, also cat'd them together. Successfully connected to gateway.sandbox.push.apple.com.
- Using the provisional profile with push notifications is enabled for development, I have a basic app that successfully prompted "Do you want to allow push notifications", so this is working correctly
- Obtained the device token
- I have tried pulling a few pre-made files for SSLing into sandbox from the internet just to see if I can get them running before I start development.
The files are the php file posted here: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12. I actually got a "Message successfully sent"
The python file posted here: Apple PNS (push notification services) sample code; I had to edit the Python 3 command "fromhash" line to str(float.fromhash(...))
I also tried using the PyAPNs API: https://github.com/simonwhitaker/PyAPNs. I still have use_sandbox set to true.
Obviously I changed the device tokens and public keys/certificates to my own. Sadly I have not received any pushed notifications yet, and I'm not receiving any concrete errors to tell me why. If anyone can shed some light, that would be amazing.
From my comment in radesix's answer, and apologies that I can provide no more detail as it's been a year since I've touched iOS development.
The problem was my provisional profile had the "aps-environment" key set to developer, but for some reason xcode defaulted to "debug". Changing this in the editor solved my problem.
Use a service like urban airship (urbanairship.com) and you'll have this up and running in minutes. Less for you to maintain in the long run also.

Resources