2014-01-24 136 views
1

我是iphone開發者。我在嘗試推送通知。我創建了證書,臨時配置文件和php腳本。我嘗試在終端中運行,然後它工作的很好。但是當我將它上載到我的服務器時,通知有時大部分顯示以下錯誤ios推送通知總是不顯示

警告:stream_socket_client function.stream-socket-client]:無法連接到ssl://gateway.sandbox.push.apple.com:2195(連接被拒絕) 無法連接:111連接被拒絕 我將ck.pem文件放入相同的php文件目錄。是否需要添加路徑?

+0

哪個證書(ck.pem)您使用的是生產或開發? – Ankush

+0

嗨,對於使用ck.pem進行開發的delay.iam抱歉。我如何檢查連接是否丟失?但有一點是我得到的通知很少。可能嗎? – user3226620

+0

您好,能否請您儘快回覆 – user3226620

回答

0

看起來你在推送通知期間失去了連接,是的,你應該添加路徑 確保你仔細檢查你使用的端口是否正確並打開。

+0

嗨,謝謝您的回覆。我如何檢查連接是否丟失?Iam使用ssl://gateway.sandbox.push.apple.com:2195.是否有任何錯誤?我們如何檢查港口是否開放。但我的事情是我很少得到通知,這是否可能。 – user3226620

+0

嗨,你能不能請回復 – user3226620

+0

在推送通知過程中我怎麼會失去連接?你能不能請回復 – user3226620

0

另請注意,推送通知並非總是有保證。您可以參考「更多關於推送通知」一節中https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/WhatAreRemoteNotif.html

Quality of Service 

Apple Push Notification Service includes a default Quality of Service (QoS) component that 
performs a store-and-forward function. If APNs attempts to deliver a notification but the device 
is offline, the QoS stores the notification. It retains only one notification per application 
on a device: the last notification received from a provider for that application. 
When the offline device later reconnects, the QoS forwards the stored notification to the device. 
The QoS retains a notification for a limited period before deleting it. 

如果設備處於脫機狀態(關閉或只是可達),那麼它就能接收最多嘗試過程中發送給您的應用程序的單一推送通知那時。

+0

謝謝你的回覆。我同意你的answer.php腳本顯示大多數時間錯誤,並很少發送通知。我得到通知,每當php顯示消息成功交付。 – user3226620

+0

嗨,你能不能請回復 – user3226620

+0

我不確定你現在需要什麼。看看這個http://stackoverflow.com/questions/13897575/apns-apple-push-notification-service-reliability – Dinesh