1

我在让 Rapns 在暂存环境中工作时遇到问题。在我的本地主机上运行开发时一切正常,但是在暂存(使用 AWS)时,我无法启动守护程序或调用Rapns.push

打电话时bundle exec rapns staging我没有收到任何错误,但没有发送通知。

使用 bundle exec rapns staging -f或尝试Rapns.push从 rails 控制台调用时,我得到:

[2013-05-29 06:54:20] [ios] Started, 1 handler.
[2013-05-29 06:54:20] [ERROR] [ios] Exception raised during startup. Notifications will     not be delivered for this app.
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:365:in `<': comparison of     Fixnum with Array failed (ArgumentError)
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:365:in `add'
    from .../shared/bundle/ruby/1.9.1/gems/activesupport-3.2.7/lib/active_support/buffered_logger.rb:80:in `add'
    from .../shared/bundle/ruby/1.9.1/gems/activesupport-3.2.7/lib/active_support/buffered_logger.rb:90:in `error'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/logger.rb:53:in `log'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/logger.rb:28:in `error'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon/app_runner.rb:34:in `rescue in sync_app'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon/app_runner.rb:30:in `sync_app'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon/app_runner.rb:20:in `block in sync'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon/app_runner.rb:20:in `each'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon/app_runner.rb:20:in `sync'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/lib/rapns/daemon.rb:47:in `start'
    from .../shared/bundle/ruby/1.9.1/gems/rapns-3.3.0/bin/rapns:36:in `<top (required)>'
    from .../shared/bundle/ruby/1.9.1/bin/rapns:23:in `load'
    from .../shared/bundle/ruby/1.9.1/bin/rapns:23:in `<main>'

同样,一切都在我的本地机器上运行良好。有任何想法吗?提前非常感谢!

4

1 回答 1

1

这可能是因为您正在使用 Rubber 部署到 AWS,并且默认情况下它配置了不同的记录器 (graylog)。

要解决此问题,请编辑 rapns 初始化程序文件 (config/initializers/rapns.rb) 并将记录器设置为默认的 rails 记录器(或您自己的):

config.logger = Rails.logger # 这是graylog设置的记录器

希望这可以帮助!

于 2013-09-12T22:13:59.693 回答