簡體   English   中英

休斯敦apn push不執行任何操作(無錯誤)

[英]houston apn push doesn't do anything (no errors)

我正在嘗試使用休斯頓發送推送通知。 我重新創建了配置文件,可以成功上傳設備令牌,但是當我使用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"的步驟進行操作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM