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.
Related
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.
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.
I'm working with a pair of phone apps (Android and iOS) and I'm running into an inconsistency with push notifications between the two platforms. Android seems to have no problems. However, the Apple app will no longer send push notifications to the user, even though it used to in the past. Firebase is used for both of the apps and I'm a little lost on what might be causing the Apple version to break. I've gone through and updated versions of Firebase and checked for deprecated references, but nothing is jumping out at me as a cause (let alone fixing the issue).
I'm pretty new to Apple development (this is in Objective C) so it could be something really simple that I'm missing.
Small update on this: After looking through where and how we use push notifications I found that I'm getting an error (assumedly from firebase) stating [{"error":"InvalidApnsCredential"}]. Obviously this has to do with the way that I've implemented the credentials for APNs, but I don't know if it's something set in Xcode or Firebase itself. I've checked the auth key's Key/TeamID's and they check out, so I'm not too sure where to look next.
I have a project with two iOS apps configured on iOS. First I created one app on firebase console, downloaded the configuration file (Google-services.plist), subscribed to a topic, and tried sending notifications from firebase console with success. Then, in the same XCode project, I changed the bundle identifier and the google-services.plist info with the info from another app. I deleted the app from the phone, made a clean and a build on the XCode project and tried to send notifications. I have no success, so I started making experiments.
After a while, I realized that I can send notifications to the device and to the topic so I tried sending notifications from the old app and then I realized that, strangely, I can receive notifications from the old app instead of the configurated app. It has no sense since the new app has a different bundle and a different google-services.plist pointing to the new bundle. Which could be my mistake?
Finally I found how to solve this. It seemed like Firebase notification server was the cause, so I deleted the two projects, created again and upload the .p12s again. Now all is working properly. I wrote these lines to help people with the same problem since I didnĀ“t found anything similar on internet.
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.