在rpush中缺少GCM的通知属性(Missing notification attribute for GCM in rpush)
在rpush gem for 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>它出什么问题了?
In the document for rpush gem for android notification, it says:
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!When I run it, a error occurred:
NoMethodError: undefined method `notification='
I checked the model, and I found it didn't include notification attribute
=> #<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>What's wrong with it?
最满意答案
将rpush版本更新到2.7.0 ,它只是在2天前升级到此版本。
Update the rpush version to 2.7.0, it just upgrade to this version 2 days ago.
更多推荐
nil,notification,false,Gcm,电脑培训,计算机培训,IT培训"/> <meta name="de
发布评论