休斯顿 APN 推送不执行任何操作(无错误)



我正试图使用Houston发送推送通知。我重新创建了配置文件,可以成功上传设备令牌,但当我使用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置于发送之后,将不显示任何内容。

首先,您应该检查您是否有一个具有推送远程通知权限的开发配置文件。

如果您的设备是iOS 8.0或更高版本,则"Please use registerForRemoteNotifications and registerUserNotificationSettings: instead");

最后,您可以执行"houston"

的步骤

最新更新