1

通過使用休斯頓,我有推送通知信息,作爲附加圖片。但是,該設備不會顯示通知消息,該信息僅顯示控制檯。我允許我的設備接受推送通知。問題是什麼?收到iOS推送通知,但不會顯示在設備上。 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 

enter image description here

+0

你的問題是什麼?推送通知似乎已經使它 – tommybananas

回答

1

確認,您的應用程序在後臺,或關閉,否則推送通知消息將不會被顯示在屏幕上。當應用程序在前臺運行時,iOS直接將推送通知消息傳遞到主機應用程序,而不在主屏幕或通知屏幕上顯示。

+0

對不起,我誤解了。感謝您的幫助。 – lalala

相關問題