小编sai*_*a m的帖子

IOS设备令牌的Pushsharp 4.0.10"连接错误"

我开发了Windows服务,使用pushsharp库向iOS和Android应用程序发送推送通知.最近我将库从2.xx更新到4.0.10并且GCM通知发送正常但Ios通知没有发送,总是得到"连接错误"我需要向数千个令牌发送通知,所以我循环遍历所有代币和排队.即使是10个令牌也会得到同样的错误.请告诉我我的代码有什么问题.这是我的代码片段

 public static void SendNotifications(List currentBrandNotications, long brandId)
 {
    byte[] appleCert = null;
    string p12File = @"aps_production_brand" + brandId.ToString().Trim() + ".p12";
    try
    {
        appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "P12\\" + p12File));               
    }
    catch (Exception ex)
    {
        logger.Debug("P12 certificate is not avilable for BrandId: " + brandId);
    }

    try
    {
        logger.Debug(" Send PushNotifications To Apple :- ");

        if (appleCert != null)
        {
            // Configuration
            var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Production, appleCert, currentBrandNotications[0].P12Password);

            // Create a new broker
            var apnsBroker = new ApnsServiceBroker(config);
            var fbs …
Run Code Online (Sandbox Code Playgroud)

ios pushsharp

5
推荐指数
0
解决办法
1229
查看次数

标签 统计

ios ×1

pushsharp ×1