我正在将fcm gem用于我的Firebase推送通知。尝试向特定用户注册设备时,我不断收到ArgumentError: wrong number of arguments (given 1, expected 4)
。它在这条线上跳了起来:
response = $firebase.add(key_name: self.user_id.to_s, project_id: ENV['FIREBASE_PROJECT_ID'], notification_key: self.user_id.to_s, registration_ids: [self.token])
在这里注册我的FCM客户:
$firebase = FCM.new(ENV['FIREBASE_KEY'])
有什么建议吗?
修改
Stacktrace:
ArgumentError:参数数量错误(给定1,预期为4) 从/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/fcm-0.0.2/lib/fcm.rb:71:in
add_registration_ids' from (irb):5 from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/console.rb:65:in
开始 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/console_helper.rb:9:in {{1} }安慰' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:49:in {{1} }' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:instart' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands/commands_tasks.rb:78:in
中在要求中 从/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:259:inrun_command!' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.0.7/lib/rails/commands.rb:18:in
中' 来自/ Users / ediewoelfle / Developer / ancient-bastion / bin / rails:9:inrequire' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in
load' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:inload_dependency' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:293:in
load_dependency ' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:在<top (required)>' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:287:in
中调用' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/command_wrapper.rb:38:inblock in load' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.0.7/lib/active_support/dependencies.rb:259:in
中服务中” 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:171:在load' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/commands/rails.rb:6:in
中' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:141:incall' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:201:in
' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:infork' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:171:in
' 来自/Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:inblock in run' from /Users/ediewoelfle/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/application.rb:135:in
require' 来自-e:1:in''