Local Notifications make sound but do not display (Swift)

前端 未结 3 944
死守一世寂寞
死守一世寂寞 2021-01-13 10:38

I am trying to create a local notification for my app using Apple\'s UNUserNotificationCenter.

Here is my code:

let center = UNUserNotificationCenter         


        
3条回答
  •  春和景丽
    2021-01-13 11:06

    I had the same problem.

    If your content body is blank ie(content.body == "") then you won't get a notification even if you do have a title.

    So the solution is to make sure that your content body is not an empty string.

提交回复
热议问题