Reputation: 594
I have an iOS app (Xcode 9 / Swift 4)
that uses Firebase Cloud Messaging
to receive silent push notifications
The app has already been published but iPhone X users are NOT receiving the notifications
I have triple checked everything, everything is up to date, including the Google Pods FirebaseMessaging (3.0.2)
My server app (c#) that generates the silent push notifications is also using the latest version of Google APIs (1.34)
So using the app that generates the notifications to test if the iPhones receives notifications, I had the following results:
And here's the worst part... if I grab the iPhone X token from the c# app and send a message via the Firebase Console it will be received by the testflight version (I guess this proves that the token I'm sending to is the correct one)
I know I'm not providing code but really there's nothing to check... everything is working perfectly on the iPhone 6S and even on the iPhone X when it's tethered to Xcode.
I was thinking that somehow my server IP address is not accessible from the iPhone X but that's not the case since during application launch I connect to the server and download data without problems... It is like the iPhone X had some kind of firewall to prevent incoming messages from my IP? Even that I know that I have the app notification permission on the iPhone X (I can send the message from the Firebase console) I created a log screen inside the app and know for a fact that the permission are enabled.
Am I missing something??? Is there an additional permission that needs to be enabled to iPhone X that I'm not aware of?
EDIT: iPhoneX iOS version = 11.4
EDIT2: Seems that, for some reason, the iPhone X needs that the payload contains "notification: {"title":"xxx", "body":"xxx"}"
which makes no sense since the iPhone 6S can receive a silent push notification without that added payload... The problem now is that adding "notification" to the payload will make iOS show the notification on tray immediately upon receiving it, witch beats the purpose of the "silent" notification I want to deliver.
Here's the previous payload that don't work on iPhone X but works on iPhone 6S (FCM takes care of adding the content-available
tag):
{"message": {"token" : "eANw_OLOKXc:APA.....XsMg", "data" : {"content" : "2546|N|495....arg|BATTERY|||||"}}}
And here's the one that works with iPhone X but will pop a system notification, witch I don't want:
{"message": {"token" : "eANw_OLOKXc:APA.....XsMg", "notification":{"title":"xxx","body":"xxx"},"data" : {"content" : "2546|N|495....arg|BATTERY|||||"}}}
Why does iPhone 6S work without the notification
payload? And how can I deliver a silent notification to iPhone X
EDIT 3: I guess the only option will be to start a new project and replicate the problem since I'm stuck... I can't understand why by running the project tethered from Xcode make it work in iPhone X but when running without the USB cable plugged in it won't receive the notification. I forgot to mention that the iPhone 6S is also on iOS 11.4
EDIT 4: I manage to get some logs directly from the iPhone X the moment a silent notification arrived:
Jun 26 01:08:46 MP apsd[9726] <Notice>: APSMessageStore - APSIncomingMessageRecordDeleteMessageForGUID <private>
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Notice>: Received incoming message on topic com.mydomain.myapp2 at priority 1
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Notice>: [com.mydomain.myapp2] Received remote notification request C752-66DA [ hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 ]
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Notice>: [com.mydomain.myapp2] Deliver push notification request C752-66DA
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Notice>: [com.mydomain.myapp2] Passing content-available push to Duet
Jun 26 01:08:46 MP SpringBoard(DuetActivityScheduler)[9680] <Notice>: SUBMITTING: <private>
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Error>: Ignoring notification with no alert, sound or badge (com.mydomain.myapp2): C752-66DA
Jun 26 01:08:46 MP SpringBoard(UserNotificationsServer)[9680] <Notice>: [com.mydomain.myapp2] Not saving push notification C752-66DA to store [ error=Error Domain=UNErrorDomain Code=1401 "Notification has no user-facing content" UserInfo={NSLocalizedDescription=Notification has no user-facing content} ]
Jun 26 01:08:46 MP dasd(DuetActivitySchedulerDaemon)[9752] <Notice>: Submitted Activity: com.apple.pushLaunch.com.mydomain.myapp2:2AD94B <private>
Jun 26 01:08:46 MP dasd(DuetActivitySchedulerDaemon)[9752] <Notice>: Daemon Canceling Activities: {(
com.apple.pushLaunch.com.mydomain.myapp2:2AD94B
)}
Jun 26 01:08:46 MP dasd(DuetActivitySchedulerDaemon)[9752] <Notice>: CANCELED: com.apple.pushLaunch.com.mydomain.myapp2:2AD94B <private>!
So it appears that iOS receives the notification, along with the data (hasContentAvailable: 1
) but it's not sending it to my app...
Also, why this error: <Error>: Ignoring notification with no alert, sound or badge
... a silent notification does not have alert / sound / badge!
Upvotes: 1
Views: 2474
Reputation: 1797
I had similar issues. I set the priority to high and added following payload.
let message = {
notification: {
title: 'title',
body: `title`
}
};
let options = {
priority: "high",
timeToLive: 60 * 60 * 24
};
It is working fine till now.
Upvotes: 4
Reputation: 2057
FirebaseMessaging (3.0.2) has problem with push notification on 11.4 try to use another version like 3.0.6
Upvotes: 0