Instance Method


Asks you to make any needed changes to the notification and notify the system when you're done.


- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent *contentToDeliver))contentHandler;



The original notification request. Use this object to get the original content of the notification.


The block to execute with the modified content. This block has no return value and takes the following parameter:


A UNNotificationContent object with the content to be displayed to the user.


Override this method and use it to modify the UNNotificationContent object that was delivered with the notification. At some point during your implementation, execute the contentHandler block and pass it your modified content. If you decide not to modify the content, call the contentHandler block with the original content from the request parameter.

You can modify any of the content from the original request. You might customize the content for the current user or replace it altogether. You can use this method to download images or movies and add them as attachments to the content. You may also modify the alert text as long as you do not remove it. If the content object does not contain any alert text, the system ignores your modifications and delivers the original notification content.

Your extension has a limited amount of time (no more than 30 seconds) to modify the content and execute the contentHandler block. If you do not execute that block in a timely manner, the system calls your extension’s serviceExtensionTimeWillExpire method to give you one last chance to execute the block. If you do not, the system presents the notification’s original content to the user.

See Also

Processing Notifications

- serviceExtensionTimeWillExpire

Tells you that your extension is about to be terminated.