iOS firebase推送没有提示音

2020-07-28  本文已影响0人  哇哈哈有点甜

firebasegoogle的移动平台,包含了许多的服务,其中就包括了推送功能,如果你也有集成,并且发现在收到推送时,没有提示音,那么你可以确认一下几点:

1.手机设置里是否打开了App的推送提示音

2.手机是否处于静音模式

3.Appdelegate中接收推送的回调函数是否有配置声音(如下图所示)

- (void)userNotificationCenter:(UNUserNotificationCenter *)center
       willPresentNotification:(UNNotification *)notification 
         withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
   //UNNotificationPresentationOptionBadge 推送角标
  //UNNotificationPresentationOptionAlert 推送弹框
 //UNNotificationPresentationOptionSound 推送提示音
completionHandler(UNNotificationPresentationOptionBadge | 
                  UNNotificationPresentationOptionAlert | 
                  UNNotificationPresentationOptionSound);
}

如果上述三点都确认无误,那么这个时候你可以向后台的朋友询问,他在推送的时候,是否有配置提示音,如果他表示一脸懵逼,神马?!这个还需要后台配置?不是自动会有系统默认提示音的吗!那么这个时候,你可以直接把以下这个链接砸给他
https://fcm.googleapis.com/fcm/send
据小编自己采坑经验,firebase是需要后台配置提示音的,不管是使用系统默认提示音还是使用自定义提示音,都是需要后台配置!一定要注意!

个人见解,如有错误,欢迎指正!

上一篇 下一篇

猜你喜欢

热点阅读