1

在我的应用程序中,我使用静默推送通知来定期通信,但我遇到了麻烦,因为我在未启动应用程序时收到的静默推送通知没有得到处理。操作系统版本为 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":""}
4

2 回答 2

1

就我而言,问题是有效载荷中的其他属性湖。我在开始时使用了这个有效载荷:

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

但添加Sound属性解决了问题:

{"aps":{"content-available":1, "sound":""}}
于 2020-11-05T03:26:58.447 回答
0

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

在这种情况下,如果您启用后台刷新,iOS 是否会启动您的应用并将通知传递给您的应用委托?

于 2019-03-07T22:21:50.240 回答