简体   繁体   中英

What is the difference between UNNotificationServiceExtension and UNNotificationContentExtension

What is the difference between UNNotificationServiceExtension and UNNotificationContentExtension.

What can one do and the other cannot. I've got through doc but couldn't figure out exact differences

First of all they are different objects:

  • UNNotificationServiceExtension - is an class. It's "lets you customize the content of a remote notification before it is delivered to the user" . For example, you could use the extension to decrypt an encrypted data block or to download images associated with the notification.
    So you don't change the UI of Notification, but you can modify notification content.
  • UNNotificationContentExtension - is an protocol. "You adopt this protocol in the custom UIViewController subclass that you use to present your interface."
    So you can create custom interface for your notification (ex. for some type of notification) and add your controls.

UNNotificationServiceExtension :

  • It has no user interface, so less control over this. Just limited functionality
  • It has excellent background mode. First, it prepares himself then displays the user.

UNNotificationContentExtension :

  • It has a user interface, You can customize your desired.
  • Its instantly displays. and content download starts after displaying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM