gpt4 book ai didi

ios - 无法通过临时分发的 pushsharp 发送推送通知

转载 作者:太空宇宙 更新时间:2023-11-03 14:07:46 24 4
gpt4 key购买 nike

我正在使用 PushSharp向应用程序发送 iOS 通知。

我已经按照示例设法使其在开发环境中工作,但是当我尝试在生产环境中发送它们时,出现以下错误:

InnerException = {"No se pudo realizar una llamada a SSPI; consulte la excepción interna."
{"SSL Stream Failed to Authenticate as Client"}

代码如下:

 var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, "path/to/file", "MyPassword", false);


// 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!");
};

// var i = JObject.FromObject(push);
// Start the broker
apnsBroker.Start ();

apnsBroker.QueueNotification(new ApnsNotification
{
DeviceToken = "somedevicetokenthatiusetotest",

Payload = JObject.Parse("{\"aps\":{\"alert\":\"My custom alert\",\"badge\":\"1\"}, \"date\": \"2016-06-07T01:38:00.541Z\"}"),
});

// 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 ();

我很确定它与证书以及如何生成证书有关。到目前为止我做了什么:

  • 创建新的分发证书
  • 创建新的 APS 生产证书
  • 创建临时分发配置文件
  • 在我的 mac 上全部安装
  • 使用分发证书代码签名和临时配置文件存档应用。
  • 将其导出以进行临时分发
  • 在授权设备上安装应用
  • 使用正确的密码从证书私钥导出 .p12 文件。

有人遇到过问题吗?

最佳答案

好吧,我最终通过将仅证书 导出为 .p12 文件,然后将该文件与 PushSharp 一起使用来实现它。

关于ios - 无法通过临时分发的 pushsharp 发送推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38001431/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com