我正在使用error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.
The process has been returned to the state before expression evaluation.
发送推送通知。
我可以在Android上发送通知,但我没有在IOS中收到它。
我使用以下代码:
gem 'fcm'
我可以在ios设备上收到Firebase控制台的通知。
答案 0 :(得分:0)
您忘记发送通知,只发送数据
尝试在FCM类实例选项中添加notification: "your message"
整个选项应该是这样的
options = {
data: {
title: 'My title',
message: 'My Message',
event: 'message'
},
notification: {
title: 'My title',
message: 'My Message',
event: 'message'
},
priority: 'high'
}
答案 1 :(得分:0)
fcm_client = FCM.new(your_firebase_key)
registration_ids= [user_device_token]
options = {
priority: 'high',
data: {
message: message,
event: 'event'
},
notification: {
body: message,
event: 'event',
sound: 'default'
}
}
fcm_client.send(registration_ids, options)
答案 2 :(得分:0)
最后,下面对我有用:
fcm = FCM.new(Rails.application.secrets.fcm_api_key, timeout: Settings.timeout)
options = {
data: {
title: "title",
message: "message",
event: ':message',
notification_type: "Notification.notification_types[notification_type]",
unread_count: "receiver.unread_notification_count",
notification_id: "id",
resource_type: "resource_type",
resource_id: "resource_id",
unread: "unread",
has_action_performed: "has_action_performed"
},
notification: {
body: "helldddo!",
title: "Shivadm",
sound: "default",
click_action: "FCM_PLUGIN_ACTIVITY",
badge: 3
},
priority: 'high',
}
response = fcm.send([fcm_id]], options)