1、原文:https://kunnan.blog.csdn.net/article/details/103702284 2、本文提供iOS12.1系统以上在后台或者被杀死无法语音播报的解决方案:
通过NotificationServiceExtension实现
mutable-content : 1
. (以极光平台推送为例,测试的时候,需要在高级设置开启mutable-content) aps = {
alert = {
body = 11;
subtitle = 111;
title = "111223411.34";
};
badge = 1;
"mutable-content" = 1;
sound = default;
};
hasHandled = 1; //标记已经在Extension中被处理,防止重复的语言播报或者打印交易小票等冗余动作。
}
{"aps":{"alert":"This is some fancy message.","badge":6,"sound": "default","content-available":true,"mutable-content":true}}
在这里插入图片描述
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler
NotificationService.m