Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xiaomi推送不成功,原因是缺少必要的参数? #3

Closed
tianlu1677 opened this issue Jun 17, 2016 · 2 comments
Closed

xiaomi推送不成功,原因是缺少必要的参数? #3

tianlu1677 opened this issue Jun 17, 2016 · 2 comments

Comments

@tianlu1677
Copy link

tianlu1677 commented Jun 17, 2016

我下载了这个包到本地,然后在push.rb 里面按照示例写了一个demo,但是缺少必要的
Must input one of: regid/topic/alias

push.rb

require 'xiaomi/push/version'
require 'xiaomi/push/error'
require 'xiaomi/push/const'
require 'xiaomi/push/client'

require 'xiaomi/push/devices/ios'
require 'xiaomi/push/devices/android'

require 'xiaomi/push/services/message'
require 'xiaomi/push/services/topic'
require 'xiaomi/push/services/feedback'

puts client_android = Xiaomi::Push::Android.new('ddddddd')
client_android.use_production!
message_android = Xiaomi::Push::Message::Android.new(
  title:'标题要有吸引力',
  description:'描述可以在手机显示两行',
  notify_type:'DEFAULT_ALL',
  extras: {
    source: 'mpush'
  }
)

puts client_android.message.send({alias:'xxxxx', message: message_android})

xiaomi返回的错误信息:

#<Xiaomi::Push::Android:0x007fa3526c6e78>
{"result"=>"error", "reason"=>"Must input one of: regid/topic/alias", "trace_id"=>"Xlm57b34466136027247wT", "code"=>21305, "description"=>"缺少必要的参数"}

@icyleaf
Copy link
Owner

icyleaf commented Jun 17, 2016

client_android.message.send(alias:'xxxxx', message: message_android)

@yincongcyincong
Copy link

所以这个报错因为什么@tianlu1677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants