我正在尝试使用 Houston 发送推送通知。我重新创建了配置文件,可以成功上传设备 token ,但是当我使用 apn 推送时,控制台没有显示任何读数。有没有办法记录 APN 正在做什么? (提交了一个 github 问题;在这里发帖希望有人遇到这个问题。
运行此代码不会返回任何结果。我也尝试从设备 token 中删除空格和 <>,结果相同。
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 或更高版本,“请改用 registerForRemoteNotifications 和 registerUserNotificationSettings:”);
最后,你可以按照"houston"
关于ios - 休斯顿 apn 推送不执行任何操作(无错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26116376/