iOS静默推送通知已取消

时间:2018-12-14 03:08:08

标签: ios silentpush

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

以下是您收到通知静默推送通知时的控制台日志。

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":""}

2 个答案:

答案 0 :(得分:0)

我有一个类似的问题。我最终发现,禁用后台刷新也会禁用向已暂停的应用程序发送静默通知。

在这种情况下,如果您enable background refresh,iOS是否会启动您的应用并将通知发送给您的应用代表?

答案 1 :(得分:0)

在我的情况下,问题是有效载荷中其他属性的泛滥。 我在开始使用这个负载:

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

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

{"aps":{"content-available":1, "sound":""}}
相关问题