Hi, friends I am unable to receive message using push notification on ios.I am able to send and receive messages in Android and able to send message from ios but not able to receive any notification please help…
Hey!
What are you using in terms of the push server? Google Firebase Cloud Messaging, OneSignal or do you handle everything on your own?
If you use Google Firebase Cloud Messaging I can help you out. Basically what you need to do is to go into the Firebase Console, under Cloud Messaging choose your app for iOS, you should have already added the Apple APN certificates, or better yet, the APN key so Firebase handles that on its own.
You then need to download the GoogleService-Info.plist file and via XCode add it to your app projects Resources folder.
I’d imagine with OneSignal it is likely similar. When you use your own Push Server then you need to use the APN certificate to do some extra things. Maybe check out this Git Repo for a NodeJS based solution, should give you an idea how to do it, even if you use something else. https://github.com/node-apn/node-apn
hi, Thank you so much for your reply.now I added the Apn key in the fcm console under cloud messaging but still not able to get any message on ios.After adding APN key generated new GoogleService-Info.plist file also and added in root directory still not working.what can be the problem? there is no error also.when i send message from fcm console it shows completed status too.
did you finally solve it?
@lqrz
Yes.Actually the problem was with the payload.
Hi mathewk, I get the same problem as you.
- I think I config everything on Apple, create AppId, add Apn key too. But when I try pushing a notification from firebase console, my app did not receive notification even it registered the FCM token. (Android is working fine)
Can you show me your solution?
Thank you
Hi, I have the same problem.
I configured everything was possible on Apple, created APN key (.p8) and before this, tryed with certificates (.p12). Added GoogleService-Info.plist with IS_GCM_ENABLED true to my project correctly (in fact, while compiling, it’s automatically added to iOS project folder and read by device).
It seems that my server sends successfully notifications to Firebase:
“Successfully sent with response: {“multicast_id”:8404586266050937268,“success”:1,“failure”:0,“canonical_ids”:0,“results”:[{“message_id”:“0:1541585250836741%5572c81aa485705f”}]}”
But I have no signal from my iOS device (iPhone 5S, iOS v. 11.2.1). When installing application, the device prompt me to accept permissions on notification and settings are added into notification system settings (“badge, sounds, banner” enabled).
If the problem is into payload, please share your solution. I’m facing this issue for days with no solution.
Now I’m trying this payload, but not worked for me:
// PAYLOAD
{
“to”: token_of_device_associated,
“collapse_key”: name_of_app,
// iOS
"aps": {
"alert": "Test background push",
"content-available": 1
},
// Android
"data": { // you can send only notification or only data(or include both)
"title": `${user.name} ${user.surname}`,
"message": mess.content,
"soundname": "default"
}
}
These are settings onto device:
// OPTIONS
const options: PushOptions = {
android: {
sound: ‘true’,
vibrate: ‘true’
},
ios: {
fcmSandbox: ‘true’,
alert: ‘true’,
badge: ‘true’,
sound: ‘true’
},
windows: {}
/,browser: {
pushServiceURL: ‘http://push.api.phonegap.com/v1/push’
}/
};
I tried also without fcmSandbox, but not worked too.
Try building with the legacy build system in Xcode. The Firebase plugin seems to have issues with the new build system.
File > Project Settings -> Legacy Build System.
Also, watch your device log when running via Xcode. Firebase will (usually) log warnings about config issues.
I already switched to Legacy Build System in Xcode and the plugin-phonegap-push seems to register correctly to service but never executo on(‘notification’) function.
Hi Daniel, I solved my problem by just changing the payload. will show you sample payload which worked for me in ios.
message = {
to: fcmId,
priority: “high”,
category: category,
“sound”: “default”,
notification: {
title: “your title”,
body: message
},
data: {
infos: “walking”, // data which you are sending with the notificaion
randid: randomid . // to avoid double event trigger
},
};
Did you add GoogleService-Info.plist to the root folder?
Same problem here.
please tell me from get the GoogleService-Info.plist file and where need to copy.
Best Rgs.
You can follow this tutorial https://medium.com/@priyeshp18/push-notifications-between-ionic-2-3-apps-using-fcm-d3971b0120ce.
in the root directory(outside src folder)
friend could you help me, to see what problem I have, I am using Firebase cloud message I did all the steps you comment and in development everything was fine, when the app goes through production through the App Store Connect those who download the app fail to receive token from firebase and I don’t know if there is any additional configuration in apple for when it goes into production.
Thank you very much for the help
hi @pedelon, did you uploaded APN certificate or authentication key to firebase cloud messaging console?
if you uploaded APN certificate you might have development and production certificates, both .should be uploaded to respective fields in cloud messaging.
Hello mathewk,
I uploaded the authentication key, I have generated the certificates for both development and production, to firebase I only uploaded the authentication key, the certificates are related in Apple with the App ID.
That is why I think that I need to configure something for the production step since only the app that I released in the App store is the one that does not get token
so your plugin not generating fcm token ?
(I did the same,but i am getting the notification for production and development.if you need any help on this i can help you)
if I need help,
what does the token generate ?, the fcm plugin or firebase?
What I don’t understand is, why in development if I get a token and not in production. what could be happening?
Which is your backend?
You can now not use @ionic-native/firebase with version 3 of ionic.
npm i ionic-native-fcm
You can try a plugin like ionic-native-fcm.
what is fcmId, randomid & category