iOS FCM push notifications not received in TestFlight - php

I have an issue with FCM and TestFlight. I have an app which is written via Objective C. It uses push notification service via Firebase. I use APNs key instead of certificates.
The issue is when I run my app in debug and in release mode via Xcode I get push notifications. When I sign app with distribution profile and send it to TestFlight and install it via TestFlight on same device push notifications not received.
We are using php server for the app. And push notifications are sent from that server via firebase. I have all the settings in AppDelegate file as it is stated in Firebase SDK docs. So all proper delegates are set and firapp configure called and so on like here. https://firebase.google.com/docs/cloud-messaging/ios/first-message Also I've checked entitlements file that APS-environment is set to Production when sending to TestFlight.
I've tried to set type of device token in didRegisterForRemoteNotificationsWithDeviceToken via [[FIRMessaging messaging] setAPNSToken: type:] to sandbox or prod whether it is debug or release mode of schema. Also I've using this code instead of that now [FIRMessaging messaging].APNSToken = deviceToken. But neither of the options work in TestFlight.
Our back-end dev says that on server push notifications are sent properly. So I suppose that it may be something related to device token.
Also I've update Firebase pods recently form version 3 to version 6. May be firebase lib on server should be updated as well?
Do you know what the issue can be? Any help is appreciated.

Update. I've found that this issue has began after updating firebase ios lib not from 3 to 6 version but from version 6.18 to 6.31.1. So my issue was bug stated in issue #6553 on official GitHub of Firebase iOS SDK. This bug was fixed in version 7.0.0. And after updating my issue was solved.
https://github.com/firebase/firebase-ios-sdk/issues/6553

Related

Testing in-app/banner notifications

I have recently joined a startup who has been using an offshore team up until now. Our app in built in Obj-C with a PHP backend, both of which I am fairly new to (I come from a JS background). I have been wanting to make some alterations to the current in-app notifications (banners), but have been unable to figure out how to test them. I am aware that testing notifications on the simulator is not possible, and have installed the developer build to my device. However, I am still not receiving any notifications when I would normally receive them in the production build, such as when a friend posts a message. If anyone has any experience with this I would love to hear it. I am currently developing in Xcode 8.2.1
This might get closed as too broad a question, but for what it's worth here are some checkpoints:
The app is enabled for notifications in iPhone Settings
The app is requesting a push token from APNS
(registerForRemoteNotificationTypes)
It receives a valid token from APNS and
passes it to your PHP server (didRegisterForRemoteNotificationsWithDeviceToken)
Your server is storing the token correctly
Your server is triggering a push notification correctly
Your development certificate is correct
(read this post iPhone APNS Device Tokens in sandbox vs. production)
If you want to test push without the server in the loop, checkout PushMeBaby (there are several on GitHub).
try it:
if app is already launched in App Store: they enabled the production certificated ... and u r running the application through Xcode ,u will not get the notifications in ur device... for that u need to create IPA file for ur project and run through iTunes...

Migrating GCM to FCM, should/could I keep my current GCM server side of code?

I've been using GCM service to send notification to my existing App, in PHP server, as per https://stackoverflow.com/a/11253231/3286489.
Now I'm thinking of migrating to FCM. As per noted https://stackoverflow.com/a/37517339/3286489, the notification service URL "https://android.googleapis.com/gcm/send" has been changed to "https://fcm.googleapis.com/fcm/send"
As I'm still newly explore the FCM, I hope my question is not dump. I have two questions here.
1.) Once migrated to FCM in my client, can I still use back the same PHP code that send my GCM as per https://stackoverflow.com/a/11253231/3286489? Or could I just change the API URL (to fcm.googleapis.com) but retain all PHP code the same? (i.e. is 'https://fcm.googleapis.com/fcm/send' backward compatible with 'https://android.googleapis.com/gcm/send'?)
2.) Upon migrated to FCM (on the server push), and even when after I have upgraded my App to use FCM instead of GCM, I believe there will still be some user that's stick to the older App for a while using GCM. When I send push notification out, do I need to send to both FCM and GCM separately (i.e. I need to keep the old GCM server code for a while)? or I just need to send the FCM, and my old App (with only GCM) will still receive it?
I hope the answer is yes for both, but feel like not likely it's yes. So write to confirm my understanding.
The answer to both is Yes.
For #1, my post that you linked pretty much answers it. So just to confirm, using the FCM endpoint to send towards your GCM users should be fine. It's still compatible.
For #2, no need to send separate payload for GCM users. As I said above, it is backwards compatible.

iOs push notifications don't work in production mode

I developed an app using push notifications. To send notifications I used PHP code. I followed the following tutorial: The tutorial
The tutorial works correctly with the development mode, but in production mode doesn't work. I repeated the tutorial using the aps_production certificate and reusing the same private key getting from the keychain.
When I execute the php I receive a successfully message but the device doesn't receive the notification. I was trying to solve the problem and I couldn't do it. I know that the device token is different and I'm using the correct token because the app sends it to a server that stores it.

Push notifications not coming in Enterprise app

I have developed a simple app for iPad which has push notifications in it as a feature.
I created its app id and enabled the push notifications and downloaded the certificates for development as well as distribution.
I created .pem files for both as well.
While using development profile, everything worked fine and push notifications were working perfect.
But when I started checking it with distribution profile push notifications didn't come.
I also got the php file changed and removed sandbox from it. I checked everything but I cannot seem to find what is missing.
Do we need to do anything exclusive for Enterprise apps for enabling push notifications in them?
Thanks in advance.
Best regards

Push Notification using GCM - PHP

I am trying to implement Push Notification using GCM,
Besically i am trying to send Notification to the GCM using my PHP server which will deliver it to my android application.
I have used code at androidhive!
The device is getting registered successfully but i am not receiving any notification at my device nor anything is visible at Google console.
I am not receiving any response from the link used https://android.googleapis.com/gcm/send or https://android.googleapis.com
Is there anything wrong in this approach?
Can anyone suggest me any authentic source for this?
Realizing that some people are facing issues implementing GCM. I have decided to post solution.
The example on AndroidHive is working perfectly. Its just the matter of correct configuration.
Replace project ID in Android app. (You can get project ID from you google's console link i.e google.com/apis/console/#project:xxxxxxxxxxxx:access)
Replace Server API Key on PHP Server(config.php)
Key for server apps (with IP locking).
You can get your IP from WhatIsMyIP.
Key for browser apps (with referers) will not work.

Categories