我正在尝试使用休斯顿发送推送通知。我重新创建了配置文件,可以成功上传设备令牌,但是当我使用apn推送时,控制台显示没有读数。有没有办法记录APN正在做什么? (提交了一个github问题;在这里发帖,希望有人遇到这个问题。
运行此代码不会返回任何内容。我试过删除空格& <>同样来自设备令牌。
Using rspec 3.1.0
Using simplecov-html 0.8.0
require 'houston'
# Environment variables are automatically read, or can be overridden by any specified options. You can also
# conveniently use `Houston::Client.development` or `Houston::Client.production`.
APN = Houston::Client.production #tried development, same result
APN.certificate = File.read("/Users/quantum/Documents/cliqupprodcerts.pem")
# An example of the token sent back when a device registers for notifications
token = "tokentoken"
# Create a notification that alerts a message to the user, plays a sound, and sets the badge on the app
notification = Houston::Notification.new(device: token)
notification.alert = "Hello, World!"
# Notifications can also change the badge count, have a custom sound, have a category identifier, indicate available Newsstand content, or pass along arbitrary data.
notification.badge = 57
notification.sound = "sosumi.aiff"
notification.category = "INVITE_CATEGORY"
notification.content_available = true
notification.custom_data = {foo: "bar"}
# And... sent! That's all it takes.
v = APN.push(notification)
puts v
~
编辑:我曾经尝试过生产,生产和销售发展不起作用。在发送之后放置notification.errors。
答案 0 :(得分:1)
首先,您应该检查您是否拥有具有推送远程通知权限的开发配置文件。
然后,如果您的设备是iOS 8.0或更高版本,"Please use registerForRemoteNotifications and registerUserNotificationSettings: instead");
最后,您可以按照 "houston"