1

我在使分段環境中的Rapns工作時遇到問題。在我的本地開發運行時 一切運作良好,但在時分期(使用AWS)我無法啓動守護程序或致電Rapns.push無法在分段環境中使用Rapns(ArgumentError:Fixnum與陣列的比較失敗)

當調用bundle exec rapns staging我沒有錯誤,但未能發送通知。

當使用bundle exec rapns staging -f或試圖調用Rapns.push從鐵軌控制檯時,我得到:

[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>' 

再次,一切正常我的本地機器上。有任何想法嗎?非常感謝!

回答

1

這可能是因爲您使用橡膠部署到AWS,並且它默認配置了其他記錄器(graylog)。

要解決這個問題,編輯rapns初始化文件(配置/初始化/ rapns.rb),並設置記錄器爲默認軌道記錄器(或您自己):

config.logger = Rails.logger#這是記錄器由graylog設置

希望這可以幫助!

+0

謝謝@kevin Liang! – ringular