本文介绍了iOS离线时的FCM行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我向离线的iOS设备发送通知时(例如处于飞行模式或关闭状态),我无法弄清楚FCM的行为.

I'm having trouble figuring out how FCM behaves when I send a notification to an iOS device that is offline (e.g. in airplane mode, or turned off).

time_to_live 属性的文档中提到Currently, time_to_live is not supported for notification messages on iOS.,但没有提供替代方法的说明.我已经尝试过测试,无论我将time_to_live属性设置为什么,似乎推送通知有时都会通过,有时却不会,尽管我不确定这是否是由于节流或其他原因引起的发生在FCM方面.

The documentation on the time_to_live property mentions that Currently, time_to_live is not supported for notification messages on iOS. but doesn't provide an explanation of what is done instead. I've tried testing it, and it seems like a push notification sometimes goes through, and sometimes does not, regardless of what I set the time_to_live property to be, although I'm not sure if that's due to throttling or something else happening on the FCM side.

相关地,虽然文档没有明确提及它不适用于iOS,但似乎无法使delay_while_idle属性在iOS上正常工作-手机处于睡眠状态时发送的通知仍会唤醒电话,即使我将delay_while_idle设置为true.

Relatedly, I can't seem to get the delay_while_idle property to work on iOS, although the documentation does not explicitly mention that it isn't available for iOS - notifications that are sent while the phone is asleep still wake the phone, even if I set delay_while_idle to be true.

有人对这应该如何工作有任何见识吗?

Does anyone have any insight into how this is supposed to work?

推荐答案

time_to_live是适用于Android和iOS的AFAIK.但是,由于将消息发送到FCM的iOS设备的过程是这样的:

The time_to_live is AFAIK applicable to both Android and iOS. However, since the process of sending the message to iOS devices for FCM goes like this:

可以肯定地说,只有FCM Server才使用time_to_live,具体取决于说明:

It is safe to say that only the FCM Server makes use of the time_to_live, as per it's description:

环顾四周,发送到离线设备时APN的行为是(来自 Apple文档):

Looking around, the behavior for APNs when sending to offline devices is (from the Apple docs):

到目前为止, delay_while_idle 现在不推荐使用.

As of now, delay_while_idle is now deprecated.

我知道您可以唤醒 iOS手机(在线/连接到体面的网络)的方法是简单地priority设置为high .

The way I know that you could do to wake up an iOS phone (online/connected to a decent network) is to simply set the priority to high.

这篇关于iOS离线时的FCM行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 10:30