Reputation: 766
I knew that there are a similar questions. Also I saw this one. Great answer, but I want to clarify two details.
Is there any way to check in code which kind of notification's banner style user use for your app "Temporary" or "Persistent"?
When iPhone is locked and user received notification from Reminders, then unlocked iPhone and locked it again, the notification will still appears on locked screen. If we do the same with another app that have "Persistent" banner style, the notification will not still appears when iPhone will locked again. So, how we can achieve notification banner behavior like in Apple's Reminders app?
Upvotes: 1
Views: 3146
Reputation: 534885
Is there any way to check in code which kind of notification's banner style user use for your app "Temporary" or "Persistent"
Sure. Call UNUserNotificationCenter getNotificationSettings
. The result is a UNNotificationSettings whose alertStyle
is .banner
[temporary] or .alert
[persistent] (or .none
, of course).
When iPhone is locked and user received notification from Reminders, then unlocked iPhone and locked it again, the notification will still appears on locked screen. If we do the same with another app that have "Persistent" banner style, the notification will not still appears when iPhone will locked again.
I don't think the behavior in the lock screen has anything to do with the "Persistent" setting. I think that with any app for which lock screen notifications are permitted, if all you do is turn on the screen (from black to lock screen) and look at it and then turn the screen off again, if there was a notification visible it will be visible the next time you do that same thing.
Upvotes: 3