繁体   English   中英

ios 13 推送通知在设备锁定后立即清除

[英]ios 13 push-notification gets cleared as soon as we get when device is locked

当我在 iOS 13 上收到推送通知时,设备被锁定。 我收到了 pushnotifcation,但它会在没有任何用户交互的情况下立即清除。

我正在使用 .net 以下是我正在使用的有效负载代码

{to = notification.DeviceToken,
                    priority = "high",                    
                    content_available = true,
                    notification = new
                    {
                        body = notification.Message, //This will be a subtitle..
                        title = notification.Name, //This will be a title..
                    },
                    data = new
                    {
                        notificationId = notification.NotificationId,
                        userId = notification.UserId,
                        encryptedNotification = Crypto.Encrypt("id", notification.NotificationId.ToString())
                    }
                };
                string postbody = JsonConvert.SerializeObject(payload).ToString();
                Byte[] byteArray = Encoding.UTF8.GetBytes(postbody);

                tRequest.ContentLength = byteArray.Length;

                **tRequest.Headers.Add("apns-push-type", "alert");**
                **tRequest.Headers.Add("apns-priority", "5");**
}```

Please guide me what wrong in code. 

have referred following azure code to implement, but not able to find the cause.

https://docs.microsoft.com/en-us/azure/notification-hubs/push-notification-updates-ios-13 

如果您的代码减少了应用程序图标的通知徽章编号,则可能会发生这种情况。 如果这样做,请确保仅在应用程序处于活动状态时才这样做。 如果它处于非活动状态并且您减少了徽章编号,则可能会导致通知出现并立即消失。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM