已收到iOS推送通知,但不会在设备上显示。休斯顿铁路公司
通过使用Houston,我获得了推送通知信息,如附件所示。但是,设备不会显示通知消息,信息仅显示在控制台上。我允许我的设备接受推送通知。有什么问题已收到iOS推送通知,但不会在设备上显示。休斯顿铁路公司,ios,ruby-on-rails,push-notification,apple-push-notifications,Ios,Ruby On Rails,Push Notification,Apple Push Notifications,通过使用Houston,我获得了推送通知信息,如附件所示。但是,设备不会显示通知消息,信息仅显示在控制台上。我允许我的设备接受推送通知。有什么问题 resource "push" do params do requires :device_token, type: String end post do APN = Houston::Client.development APN.certificate = File.read(Rails.
resource "push" do
params do
requires :device_token, type: String
end
post do
APN = Houston::Client.development
APN.certificate = File.read(Rails.root.join('certificates', 'apns', '150927Development.pem'))
# An example of the token sent back when a device registers for notifications
token = params[:device_token]
# 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, indicate available Newsstand content, or pass along arbitrary data.
notification.badge = 57
notification.sound = "sosumi.aiff"
notification.content_available = true
notification.custom_data = {foo: "bar"}
Rails.logger.debug
APN.push(notification)
end
end
确保您的应用程序处于后台或已关闭,否则推送通知消息将无法在屏幕上显示。当应用程序在前台运行时,iOS直接将推送通知消息传递给主机应用程序,而不在主屏幕或通知屏幕上显示 你的问题是什么?推送通知似乎让我感到担忧,我误解了。谢谢你的帮助。