File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
messaging/MessagingExample Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,15 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
122122 NSLog (@" %@ " , userInfo);
123123
124124 // Change this to your preferred presentation option
125- completionHandler (UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionAlert );
125+ // Note: UNNotificationPresentationOptionAlert has been deprecated.
126+ if (@available (iOS 14.0 , *)) {
127+ completionHandler (UNNotificationPresentationOptionList |
128+ UNNotificationPresentationOptionBanner |
129+ UNNotificationPresentationOptionSound );
130+ } else {
131+ completionHandler (UNNotificationPresentationOptionAlert |
132+ UNNotificationPresentationOptionSound );
133+ }
126134}
127135
128136// Handle notification messages after display notification is tapped by the user.
You can’t perform that action at this time.
0 commit comments