推送实现 应用未启动情况下的自定义声音播放
1、将推送的权限证书等配置好
2、创建 UNNotificationServiceExtension (iOS 10及以后)
3、在
- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler 方法中拿到
self.content = [request.content mutableCopy];
并将self.content
.sound = [UNNotificationSound soundNamed:[NSString stringWithFormat:@"%@.mp3",soundFileUrl]]; 设置成自己想要播放的声音