【发布时间】:2017-09-21 07:29:06
【问题描述】:
使用fcm 推送通知 ios 和 Android
请求:
fcm = FCM.new(ENV["FCM_TOKEN"])
options = {data: {message: message}, priority:'high'}
response = fcm.send(device_tokens, options)
回应:
{:body=>
"{"multicast_id":8122297942819980145,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1505802064679190%9310a6bdf9fd7ecd"}]}",
:headers=>
{"content-type"=>["application/json; charset=UTF-8"],
"date"=>["Tue, 19 Sep 2017 06:21:04 GMT"],
"expires"=>["Tue, 19 Sep 2017 06:21:04 GMT"],
"cache-control"=>["private, max-age=0"],
"x-content-type-options"=>["nosniff"],
"x-frame-options"=>["SAMEORIGIN"],
"x-xss-protection"=>["1; mode=block"],
"server"=>["GSE"],
"alt-svc"=>["quic=":443"; ma=2592000; v="39,38,37,35""],
"accept-ranges"=>["none"],
"vary"=>["Accept-Encoding"],
"connection"=>["close"]},
:status_code=>200,
:response=>"success",
:canonical_ids=>[],
:not_registered_ids=>[]}
发现很少讨论但没有帮助
传递选项:'priority': 'high' 可能会解决问题。 但对我不起作用。
面临设备未接收到的 Ios 通知问题。 相同的设置适用于 Android。
如果我在这里做错了什么,请告诉我。
【问题讨论】:
-
您需要为 iOS 配置单独的有效负载,这将与 Android 不同。
-
@NaumanMalik 你能告诉我样本有效载荷吗?
-
尝试了不同的有效负载以及没有工作选项 = {data: {message: message, notify_type: notify_type}, priority:'high', notification: { body:'BODY', title:'TITLE ' }, mutable_content: true } 相同的响应,但没有在设备中收到
标签: ios firebase push-notification apple-push-notifications ruby-on-rails-5.1