0

我在 iOS 13 上遇到了通知服务扩展问题。这个问题并不总是发生。当我在开发苹果服务器 (api.sandbox.push.apple.com:443) 上推送可变内容 = 1 的通知时,Apple 在我的服务器上返回成功,但没有通知到达我的设备。有时它仍然会出现,但很晚,例如我在上午 9:00 推送它,它在上午 9:15 到达我的设备,并准确显示时间(15 分钟前)。这是苹果的错误还是我的错误?如果这是我的错误,我该如何解决?如果是 Apple 的错误,它会发生在真实服务器上吗(api.push.apple.com:443)?谢谢!

4

1 回答 1

0

“可变内容”应该在“aps”字典中

Try this if you are sending from apns server

{
"aps": {
    "category": "content_added_notification",
    "alert": {
        "title": "Photos",
        "body": "Antoine added something new - take a look"
    },
    "mutable-content": 1
},
"image_url": "https://www.example.com/image_url"
}

如果你是从 firebase 发送的

 let dict = ["to": "SERVER-KEY",
             "notification":["body":"body text",
                             "title":"notification text",
                             "category": "myNotificationCategory",
                             "mutable-content": true],
             "data":[
                             "mediaUrl": "https://homepages.cae.wisc.edu/~ece533/images/airplane.png"

        ]]as [String:Any]
于 2019-11-18T12:33:03.667 回答