我在iOS 13上遇到Notification Service Extension的问题。此问题并不总是发生。 当我在开发Apple服务器(api.sandbox.push.apple.com:443)上推送mutable-content = 1的通知时,Apple在服务器上返回成功,但是没有通知发送到我的设备。有时它仍然会出现,但是很晚,例如,我在9:00 AM推送它,它在9:15 AM到达我的设备,并准确显示时间(15分钟前)。 这是苹果错误还是我的错误?如果是我的错误,该如何解决?如果是Apple的错误,是否会在真实服务器上发生(api.push.apple.com:443)? 谢谢!
答案 0 :(得分: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]