Trying to get UNNotificationExtensionOverridesDefaultTitle to work.

In the docs for UNNotificationContentExtension, it reads:


UNNotificationExtensionOverridesDefaultTitle. (Optional) The value of this key is a Boolean. When set to

YES
, the system uses the
title
property of your view controller as the title of the notification. When set to
NO
, the system sets the notification's title to the name of your app. If you do not specify this key, the default value is set to false.


I've configured my plist with this key/value pair with YES, but the notification title is blank. I've tried setting the View Controller's title in my storyboard, in the View Controller's viewDidLoad, and by overriding the title property. But my notification is displayed with no title at all, not even the app name as is the default. Has anybody gotten this to work?

Replies

It's working well.


Try to set the title of the view controller, programmatically, like that:


- (void)didReceiveNotification:(UNNotification *)notification {
     self.title = @"My Custom Title";
}