2016-05-05 5 views
2

私はiPhoneに通知を送信し、testflightを使用してアプリをインストールするためのプロダクションバージョン.p12ファイルを作成しました。問題のプッシュシャープApple通知バージョン4.0.10.0からTestflight

私のサンプルコンソールアプリケーションから通知を送信するときに、通知がコールバックを送信するようになっていますが、通知はデバイスに送信されません。

マイPushsharpバージョンは、通知を送信するため4.0.10.0 とコードである。このようなものになります。通知は、通知は、コールバックが来ている送信されていても受信されていない理由、誰もこれで私を助けることができる

public static void SendAppleNotification() 
    { 
     // Configuration (NOTE: .pfx can also be used here) 
     var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, "C:\\Users\\MancMiniUser\\Documents\\visual studio 2013\\Projects\\PushSharpDemo\\PushSharpDemo\\Resources\\P12CertifyPIE.p12", "1234"); 

     // Create a new broker 
     var apnsBroker = new ApnsServiceBroker(config); 

     // Wire up events 
     apnsBroker.OnNotificationFailed += (notification, aggregateEx) => 
     { 

      aggregateEx.Handle(ex => 
      { 

       // See what kind of exception it was to further diagnose 
       if (ex is ApnsNotificationException) 
       { 
        var notificationException = (ApnsNotificationException)ex; 

        // Deal with the failed notification 
        var apnsNotification = notificationException.Notification; 
        var statusCode = notificationException.ErrorStatusCode; 

        Console.WriteLine("Apple Notification Failed: ID={apnsNotification.Identifier}, Code={statusCode}"); 

       } 
       else 
       { 
        // Inner exception might hold more useful information like an ApnsConnectionException   
        Console.WriteLine("Apple Notification Failed for some unknown reason : {ex.InnerException}"); 
       } 

       // Mark it as handled 
       return true; 
      }); 
     }; 

     apnsBroker.OnNotificationSucceeded += (notification) => 
     { 
      Console.WriteLine("Apple Notification Sent!"); 
     }; 

     // Start the broker 
     apnsBroker.Start(); 


     // Queue a notification to send 
     apnsBroker.QueueNotification(new ApnsNotification 
     { 
      DeviceToken = "3cfcc2ceefe6675d89b063e2e39d03503b3917250e6743d185c755e9e2c3579d", 
      Payload = JObject.Parse("{\"aps\":{\"alert\":\"Hello from sourabh v.4.0 Tester.\",\"badge\":\"1\"}}") 

     }); 

     // Stop the broker, wait for it to finish 
     // This isn't done after every message, but after you're 
     // done with the broker 
     apnsBroker.Stop(); 
    } 

を? \ Users \ユーザーMancMiniUserドキュメントは2013年のVisual Studioを\ \ \:

答えて

2

はあなたが

  • VARの設定=新しいApnsConfiguration ApnsConfiguration.ApnsServerEnvironment.Production(ApnsConfiguration.ApnsServerEnvironment.Production、「Cとして使用、その後の生産証明書を作成しましたProjects \ PushSharpDemo \ PushSharpDemo \ Resources \ P12CertifyPIE.p12 "、" 1234 ");