Flutter/ios: Cant get firebase messaging to work - ios

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.

Related

react-native-push-notification remote doesn't show when I test with real ios device with xcode

I'm using react-native-push-notification.
I'm trying to test push notifications, if I build app and upload it to testflight it shows remote notifications just fine, but when I do it with xcode build on a real device it doesn't react at all (I'm getting onRegister call and notification token though). This problem is only on IOS, android getting notifications in production and development. Can't google anything related so probably I'm missing something.
P.S. I'm using backend to send notifications through firebase
you have to go in capaibility in xcode and active PushNotification first
for more info see this
hope you have followed all the steps to get the APNS certificate and attached that to your xcode, before the build, if not please do so.
Also, in addition you need to have .pem file to add to your Firebase to make your ios app enable to send and receive push.

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.

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

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.

Phonegap PushPlugin can't receive notifications ios

I am developing a Phonegap application for both Android and iOS and would like to enable push notifications for both.
The app is using the Phonegap plugin PushPlugin which sets it to receive notification for both Android and iOS.
I am having issue with the iOS version of the app. When running it, I get the screen asking if I want to allow the app to receive notifications, I select yes then I receive a device token which is then used on the server side to send the notification to the selected device. This was a good indication that the Phonegap plugin was working.
Server side, I am using AmazonSNS to send the notifications. (Java code of this can be downloaded here.)
With AmazonSNS I need to pass in:
certificate (created in the online iOS development center)
private key (exported from the certificate)
device token (from PushPlugin)
to send the notification.
I followed this detailed tutorial on how to get the app id, certificate, private key and provisioning profile all set up.
The problem is, after sending the notification, not only does the app not receive the notification, but sending the notification doesn't error or give me any feedback as to what might have went wrong.
I'll also point out, the Android version of the app is successfully receiving notifications using the same java code.
Any advice on what the issue here might be would be great.
Thanks
I managed to work out what the problem was.
In my server-side plugin, I was trying to connect to APNS directly, but what I should of been doing was connecting to APNS_SANDBOX.

Resources