rpush 中缺少 GCM 的通知属性
Missing notification attribute for GCM in rpush
在 rpush
gem android 通知的文档中,它说:
n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name("android_app")
n.registration_ids = ["..."]
n.data = { message: "hi mom!" }
n.priority = 'high' # Optional, can be either 'normal' or 'high'
n.content_available = true # Optional
# Optional notification payload. See the reference below for more keys you can use!
n.notification = { body: 'great match!',
title: 'Portugal vs. Denmark',
icon: 'myicon'
}
n.save!
当我运行它时,发生错误:
NoMethodError: 未定义方法`notification='
我检查了模型,发现它不包含 notification
属性
=> #<Rpush::Client::ActiveRecord::Gcm::Notification:0x007fb90f610790
id: nil,
badge: nil,
device_token: nil,
sound: "default",
alert: nil,
data: nil,
expiry: 86400,
delivered: false,
delivered_at: nil,
failed: false,
failed_at: nil,
error_code: nil,
error_description: nil,
deliver_after: nil,
created_at: nil,
updated_at: nil,
alert_is_json: false,
type: "Rpush::Client::ActiveRecord::Gcm::Notification",
collapse_key: nil,
delay_while_idle: false,
registration_ids: nil,
app_id: nil,
retries: 0,
uri: nil,
fail_after: nil,
processing: false,
priority: nil,
url_args: nil,
category: nil,
content_available: false>
怎么了?
更新rpush
版本到2.7.0
,2天前刚升级到这个版本
在 rpush
gem android 通知的文档中,它说:
n = Rpush::Gcm::Notification.new
n.app = Rpush::Gcm::App.find_by_name("android_app")
n.registration_ids = ["..."]
n.data = { message: "hi mom!" }
n.priority = 'high' # Optional, can be either 'normal' or 'high'
n.content_available = true # Optional
# Optional notification payload. See the reference below for more keys you can use!
n.notification = { body: 'great match!',
title: 'Portugal vs. Denmark',
icon: 'myicon'
}
n.save!
当我运行它时,发生错误:
NoMethodError: 未定义方法`notification='
我检查了模型,发现它不包含 notification
属性
=> #<Rpush::Client::ActiveRecord::Gcm::Notification:0x007fb90f610790
id: nil,
badge: nil,
device_token: nil,
sound: "default",
alert: nil,
data: nil,
expiry: 86400,
delivered: false,
delivered_at: nil,
failed: false,
failed_at: nil,
error_code: nil,
error_description: nil,
deliver_after: nil,
created_at: nil,
updated_at: nil,
alert_is_json: false,
type: "Rpush::Client::ActiveRecord::Gcm::Notification",
collapse_key: nil,
delay_while_idle: false,
registration_ids: nil,
app_id: nil,
retries: 0,
uri: nil,
fail_after: nil,
processing: false,
priority: nil,
url_args: nil,
category: nil,
content_available: false>
怎么了?
更新rpush
版本到2.7.0
,2天前刚升级到这个版本