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

标签 ios push-notification apple-push-notifications

我正在尝试使用 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/

相关文章:

android - 适用于 Android 模拟器的 Appcelerator Titanium 推送通知?

php - fwrite() : SSL operation failed with code 1. OpenSSL 错误消息:\nerror:1409F07F:SSL 例程:SSL3_WRITE_PENDING:PHP 中的错误写入重试

ios - 缺少 "aps-environment"权利。注册失败

iphone - 选择器没有已知的实例方法

当屏幕快速关闭时,IOS 音频停止播放

iphone - 如何实现天气应用的温度徽章?

node.js - 如何创建签名文件以从nodejs服务器在safari中发送网络推送通知

ios - 在生产中捕获 UIViewAlertForUnsatisfiableConstraints

ios - swift : How to convert String to string with time format?

ios - 推送通知不工作