iOS静默推送通知已取消 [英] iOS silent push notification cancelled

查看:160
本文介绍了iOS静默推送通知已取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用静默推送通知来定期进行通信,但是由于没有处理我在不启动应用程序时收到的静默推送通知,因此我遇到了麻烦.操作系统版本为iOS12.我正在使用FCM发送推送通知.有人遇到同样的问题吗?

In my application, I use silent push notification in order to communicate regularly, but I am in trouble because the silent push notification I received while not launching the application is not processed. OS version is iOS12. I am using FCM to send push notifications. Is there anyone with the same problem?

当您收到通知静默推送通知时,下面是控制台日志.

Below is the console log when you receive a notification silent push notification.

10:41:09.395630 +0900    apsd    <APSPushHistory: 0x135ee6fe0> timestampForTopic? ##my.app.bundleidentifier## token <##token##>
10:41:09.410548 +0900    apsd    <APSPushHistory: 0x135ee6fe0> hasPayload? <##payload##> forTopic ##my.app.bundleidentifier## tokens (
    <##token##>
)
10:41:09.428957 +0900    apsd    copyAppSpecificTokensWithDomain - sandbox.push.apple.com for topic ##my.app.bundleidentifier## account ##account##
10:41:09.429047 +0900    apsd    <APSPushHistory: 0x135ee6fe0> receivedPushWithTopic ##my.app.bundleidentifier## token <##token##> payload <##payload##> timestamp Thu Dec 13 10:41:09 2018
10:41:09.429660 +0900    apsd    <APSCourier: 0x135ed8f50>: Received message for enabled topic '##my.app.bundleidentifier##' onInterface: NonCellular with payload '{
    aps =     {
        "content-available" = 1;
    };
    "gcm.message_id" = "##gcm.message_id##";
}' with priority 5 for device token: NO
10:41:09.439475 +0900    SpringBoard    <APSConnection: 0x2804c4480> Delivering message from apsd: <APSIncomingMessage: 0x283cd4ab0> 1641282366 ##my.app.bundleidentifier##
10:41:09.440909 +0900    SpringBoard    <APSConnection: 0x2804c4480> making delegate (<UNSRemoteNotificationServer: 0x2800c19a0>) calls to deliver message 1641282366 {
    aps =     {
        "content-available" = 1;
    };
    "gcm.message_id" = "0:1544665268470982%cdf8ec08cdf8ec08";
} for topic ##my.app.bundleidentifier##
10:41:09.441303 +0900    SpringBoard    Received incoming message on topic ##my.app.bundleidentifier## at priority 1
10:41:09.442552 +0900    SpringBoard    [##my.app.bundleidentifier##] Received remote notification request A9C2-0C29 [ hasAlertContent: 0, hasSound: 0 hasBadge: 0 hasContentAvailable: 1 hasMutableContent: 0 ]
10:41:09.442651 +0900    SpringBoard    [##my.app.bundleidentifier##] Deliver push notification A9C2-0C29
10:41:09.442749 +0900    SpringBoard    [##my.app.bundleidentifier##] Request DUET delivers content-available push notification to application
10:41:09.443031 +0900    SpringBoard    [##my.app.bundleidentifier##] Not delivering user visible notification A9C2-0C29 because it has no alert, sound or badge
10:41:09.443141 +0900    SpringBoard    [##my.app.bundleidentifier##] Not delivering user visible push notification A9C2-0C29 [ error=Error Domain=UNErrorDomain Code=1401 "Notification has no user visible content" UserInfo={NSLocalizedDescription=Notification has no user visible content} ]
10:41:09.444107 +0900    dasd    Submitted Activity: com.apple.pushLaunch.##my.app.bundleidentifier##:A9B065 <private>
10:41:09.446320 +0900    dasd    Daemon Canceling Activities: {(
    com.apple.pushLaunch.##my.app.bundleidentifier##:A9B065
)}
0:41:09.446567 +0900    dasd    CANCELED: com.apple.pushLaunch.##my.app.bundleidentifier##:A9B065 <private>!
10:44:50.932320 +0900    locationd    {"msg":"client getting effective client name", "bundleId":"##my.app.bundleidentifier##", "bundlePath":""}

推荐答案

在我的案例中,问题是有效载荷中其他属性的泛滥.我在开始时就使用了这个有效负载:

In my case the problem was the lake of other properties in the payload. I was using this payload at the beggining:

{"aps":{"content-available":1}}

但添加声音属性可解决此问题:

but adding the Sound property fixed the problem:

{"aps":{"content-available":1, "sound":""}}

这篇关于iOS静默推送通知已取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆