2014-04-18 7 views
2

개인 NotificationService ConfigureNotificationService (부울 샌드 박스는, 문자열 p12File는 문자열 p12FilePassword는) { // 실제 코드는 다음 시작 -------------------------푸시 알림

 string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File); 

     NotificationService service = new NotificationService(sandbox, p12Filename, p12FilePassword, 1); 

     service.SendRetries = 5; //5 retries before generating notificationfailed event 
     service.ReconnectDelay = 60000; //5 seconds 

     service.Error += new NotificationService.OnError(service_Error); 
     service.NotificationTooLong += new NotificationService.OnNotificationTooLong(service_NotificationTooLong); 

     service.BadDeviceToken += new NotificationService.OnBadDeviceToken(service_BadDeviceToken); 
     service.NotificationFailed += new NotificationService.OnNotificationFailed(service_NotificationFailed); 
     service.NotificationSuccess += new NotificationService.OnNotificationSuccess(service_NotificationSuccess); 
     service.Connecting += new NotificationService.OnConnecting(service_Connecting); 
     service.Connected += new NotificationService.OnConnected(service_Connected); 
     service.Disconnected += new NotificationService.OnDisconnected(service_Disconnected); 
     return service; 
    } 

alertNotification.Payload.Alert.Body = string.Format ("{0} {1 } 당신에게 친구 요청을 보냈습니다. ","testing ","TESTING "); // alertNotification.Payload.Badge = totalCount; alertNotification.Payload.AddCustom ("SourceType", "FriendRequest $"+ obj.ContentId);

service.QueueNotification (alertNotification);

위의 코드는 지난 주까지 잘 작동하는 코드입니다.이 때 장치에 알림이 전송되지 않습니다. 결국 service_Error 메서드에 오류가 발생합니다. "예기치 않은 EOF 또는 전송 스트림에서 0 바이트. " 2 ~ 3 샌드 박스 인증을 시도했지만 동일한 오류가 발생합니다 도와주세요.

+0

나는 정확히 같은 문제가 있습니다. 푸시는 프로덕션 인증서와 함께 작동하지만 개발자가 동일한 예외가 있습니다. 6 일 전에 시작되었는데 완벽 해지기 시작했습니다. – Tom

답변

3

내 문제 OpenSslStream 변화에 의해 해결된다 :

apnsStream.AuthenticateAsClient (this.Host, this.certificates, System.Security.Authentication.SslProtocols.Ssl3 거짓);

apnsStream.AuthenticateAsClient TO (this.Host, this.certificates, System.Security.Authentication.SslProtocols.Default, 거짓);

+0

언제 변경해야합니까? 내 코드에서 'apnsStream'이 보이지 않는다. – Dima

+0

위의 코드는 APNS-Sharp 1.0.4.4 버전 용이다. PushSharp 최신 버전을 사용하는 경우 ** ApplePushChannel.cs **에서 'stream.AuthenticateAsClient (this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Tls, false);'를 찾을 수 있습니다. – June