Summary of new iOS feature updates

Last updated:2022-11-11

iOS 14 New Features

The new features in iOS 14 mainly include APP Clip, clipboard, privacy protection and other new features, but there is no notification related new features.

iOS 13 New Features

The new features of iOS 13 mainly include Drak Mode, Swift UI and other new features, but there are no new features related to notification.

iOS 12 New Features

Grouping push

In iOS 12, notifications of the same type are combined into a notification group. Users can expand all notifications in the group by clicking on the notification group

Two grouping methods are used for notification grouping: Automatic grouping and Thread identifier. Developers do not need to do anything else with automatic grouping, the system will group the push according to the bundleId of the App. If you need to group notifications more carefully, you need to use thread identifiers.
Users can set groups (automatic, by application, off)

The Thread identifier attribute has been around since iOS10, but it's only in iOS12 that it's really implemented grouping.

// The unique identifier for the thread or conversation related to this notification request. It will be used to visually group notifications together. @property (NS_NONATOMIC_IOSONLY, copy) NSString *threadIdentifier __TVOS_PROHIBITED;
          // The unique identifier for the thread or conversation related to this notification request. It will be used to visually group notifications together.
@property (NS_NONATOMIC_IOSONLY, copy) NSString *threadIdentifier __TVOS_PROHIBITED;

        
This code block in the floating window

Summary Format Setting

After the notification is automatically grouped, there is a message digest at the bottom. The default format is: n more notifications. The format is customizable. The first: Format customization through the UNNotificationCategory

+ (instancetype)categoryWithIdentifier:(NSString *)identifier actions:(NSArray<UNNotificationAction *> *)actions intentIdentifiers:(NSArray<NSString *> *)intentIdentifiers hiddenPreviewsBodyPlaceholder:(nullable NSString *)hiddenPreviewsBodyPlaceholder categorySummaryFormat:(nullable NSString *)categorySummaryFormat options:(UNNotificationCategoryOptions)options __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED;
          + (instancetype)categoryWithIdentifier:(NSString *)identifier
                               actions:(NSArray<UNNotificationAction *> *)actions
                     intentIdentifiers:(NSArray<NSString *> *)intentIdentifiers
         hiddenPreviewsBodyPlaceholder:(nullable NSString *)hiddenPreviewsBodyPlaceholder
                 categorySummaryFormat:(nullable NSString *)categorySummaryFormat
                               options:(UNNotificationCategoryOptions)options __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED;

        
This code block in the floating window

The second is customization through UNNotificationContent

/// The argument to be inserted in the summary for this notification. @property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *summaryArgument __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; /// A number that indicates how many items in the summary are represented in the summary. /// For example if a podcast app sends one notification for 3 new episodes in a show, /// the argument should be the name of the show and the count should be 3. /// Default is 1 and cannot be 0. @property (NS_NONATOMIC_IOSONLY, readonly, assign) NSUInteger summaryArgumentCount __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
          /// The argument to be inserted in the summary for this notification.
@property (NS_NONATOMIC_IOSONLY, readonly, copy) NSString *summaryArgument __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;

/// A number that indicates how many items in the summary are represented in the summary.
/// For example if a podcast app sends one notification for 3 new episodes in a show,
/// the argument should be the name of the show and the count should be 3.
/// Default is 1 and cannot be 0.
@property (NS_NONATOMIC_IOSONLY, readonly, assign) NSUInteger summaryArgumentCount __IOS_AVAILABLE(12.0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;

        
This code block in the floating window

Inform management

Apple added a "Manage" button for messages that you can swipe left to appear.

A temporary authorization

The main embodiment of temporary authorization is that there will be two buttons in the push message, which will actively let the user choose

Warning notice

Such as family safety, health, public safety and other factors. This message requires that the user must take action. The simplest scenario is when we have a camera installed in our house and we go to work. If there is someone in the house, the camera will send us a message. This type of notification requires a special certificate.

iOS 10 New Features

Instructions

iOS 10 adds a number of new features around notifications. See engagelab's official Blog for more details.

iOS 10 Service Extension

Instructions

Service Extension added in iOS 10 The official illustration is shown below This means that before APNs reaches our device, they are processed by a layer of Extension services that allow users to set up their own Settings, adding variety to APNs.

Method of use

Service Extension is easy to use. First we need to create a Service Extension service, as shown in the following figure

And then there are a couple of things to note here

  • The Service Extension's Bundle Identifier cannot be the same as the Bundle Identifier of the Main Target (your own App Target). Otherwise, a duplicate BundeID error will be reported.
  • The Bundle Identifier of the Service Extension must be in the namespace of the Main Target. For example, the BundleID of the Main Target is io.mtpush.xxx. Then the BundleID for Service Extension should be similar to the format of io.mtpush.xxx.yyy. If you don't, you may encounter an error.

So now that your Service Extension has been created and you've successfully used the Service Extension, but it looks like we haven't done anything with it yet, look at your project and you've got a class that contains two methods.

  • didReceiveNotificationRequest:(UNNotificationRequest _)request withContentHandler:(void (^)(UNNotificationContent _contentToDeliver))contentHandler
  • serviceExtensionTimeWillExpire

Let's look at the official explanation for the first method:Call contentHandler with the modified notification content to deliver. If the handler is not called before the service's time expires then the unmodified notification will be delivered。 To explain briefly, this method is called when APNs arrives, and you can process the content that is pushed, then use contentHandler to do the processing. But if the time is too long, the APNs will be displayed as is. That is, we can process our notifications in this method and personalize them to the user. The second approach, however, is a remedy for the first. The second method calls back before expiration, when you can do some urgent processing on your APNs message.

IOS 9 integration

iOS 9 changes affect SDK sections:

  • Added the bitCode encoding format. When the SDK does not support bitCode, users cannot enable the bitCode option during integration.
    • Symptom: After a user integrates the SDK, the SDK fails to be compiled, and the error log contains bitCode error information
  • The default connection is https. If the request is http, plist needs to be manually configured to support the http service. Currently, all our server requests go to the http service.
    • Symptom: After users integrate the SDK, all http services related to MTPush prompt a connection error or connection timeout. This may be the problem.

bitCode solution

  • MTPush iOS SDK v1.8.7 and later has added support for bitCode, a new feature of iOS 9.

Https Solution

This step is not required for MTPush 2.0.0 or later

  • You need to actively add NSAppTransportSecurity type Dictionary to the Info.plist of the current project.
  • Add NSAllowsArbitraryLoads of type Boolean under NSAppTransportSecurity, set to YES

iOS 9 UIUserNotificationActionBehaviorTextInput

Support version

The v1.8.0 version is available.

  1. The biggest change in iOS 9 in terms of push is the modification of push Category type. Based on the original push categories, a text Action type has been added. This parameter is used to register items entered through notification shortcut text.
  2. This category consists of a series of UIUserNotificationCategory. Each UIUserNotificationCategory object allows you to add a set of UIMutableUserNotificationAction type parameters to increase the items on the notification bar. Now iOS9 in original UIMutableUserNotificationAction type adds Text input type (UIUserNotificationActionBehaviorTextInput), Set via behavior (a property only available in iOS9).
  3. iOS9 uses two new callback methods to handle the event of a button click:
- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullableNSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0) - (void)application:(UIApplication *)application handleActionWithIdentifier:(nullableNSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0)
          - (void)application:(UIApplication *)application handleActionWithIdentifier:(nullableNSString *)identifier forLocalNotification:(UILocalNotification *)notification withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0)

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullableNSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0)

        
This code block in the floating window

说明:

  • When the Action is UIUserNotificationActionBehaviorTextInput, Need through responseInfo UIUserNotificationActionResponseTypedTextKey To get the input text, UIUserNotificationTextInputActionButtonTitleKey get click on the button type.
  • When the Action for UIUserNotificationActionBehaviorDefault responseInfo is nil, through identifier to distinguish what are click the button to do processing.

Client Settings

Set up notifications with quick replies

# ifdef __IPHONE_9_0 UIMutableUserNotificationAction *replyAction = [[UIMutableUserNotificationAction alloc]init]; replyAction.title = @"Reply"; replyAction.identifier = @"comment-reply"; replyAction.activationMode = UIUserNotificationActivationModeBackground; replyAction.behavior = UIUserNotificationActionBehaviorTextInput; UIMutableUserNotificationCategory *category = [[UIMutableUserNotificationCategory alloc]init]; category.identifier = @"reply"; [category setActions:@[replyAction] forContext:UIUserNotificationActionContextDefault]; # endif
          # ifdef __IPHONE_9_0 
 UIMutableUserNotificationAction *replyAction = [[UIMutableUserNotificationAction alloc]init];
 replyAction.title = @"Reply";
 replyAction.identifier = @"comment-reply";
 replyAction.activationMode = UIUserNotificationActivationModeBackground;
 replyAction.behavior = UIUserNotificationActionBehaviorTextInput;
  
 UIMutableUserNotificationCategory *category = [[UIMutableUserNotificationCategory alloc]init];
 category.identifier = @"reply";
 [category setActions:@[replyAction] forContext:UIUserNotificationActionContextDefault];
# endif

        
This code block in the floating window

Use callback functions

- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0) {if ([identifier isEqualToString:@"comment-reply"]) {NSString *response = responseInfo[UIUserNotificationActionResponseTypedTextKey]; // Process the input text } completionHandler();}
          - (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void(^)())completionHandler NS_AVAILABLE_IOS(9_0) {if ([identifier isEqualToString:@"comment-reply"]) {NSString *response = responseInfo[UIUserNotificationActionResponseTypedTextKey];
 // Process the input text
 }
 completionHandler();}

        
This code block in the floating window

Server side Settings

Server content formats: aps increase category field, when the field match with client UIMutableUserNotificationCategory identifier, trigger the action of setting and display button.

payload example: {"aps":{"alert":"example", "sound":"default", "badge": 1, "category":"reply"}}
          payload example:
{"aps":{"alert":"example", "sound":"default", "badge": 1, "category":"reply"}}

        
This code block in the floating window

iOS 8 UILocalNotification

Three parameters have been added to UILocalNotification in iOS 8: region, regionTriggersOnce, and category.

  • region: controls when a user enters or leaves a geographical location, the notification is triggered. To use this feature, the user needs to have the "when-in-use" permission for CoreLocation.
  • regionTriggersOnce(BOOL) : When YES, notifications are triggered only once, and when NO, notifications are triggered on each entry or departure.
  • category: If localNotification through + [UIUserNotificationSettings SettingsForUserNotificationTypes: userNotificationActionSettings:] registered, through which the category can get the notice of registration category.

Client Settings

The use of UILocalNotification

// set localNotification CLLocationCoordinate2D coordinate2D; coordinate2D.latitude = 100.0; coordinate2D.longitude = 100.0; CLRegion *currentRegion = [[CLCircularRegion alloc] initWithCenter:coordinate2D radius:CLLocationDistanceMax identifier:@"test"]; [APService setLocalNotification:[NSDate dateWithTimeIntervalSinceNow:120] alertBody:@"test ios8 notification" badge:0 alertAction:@"取消" identifierKey:@"1" userInfo:nil soundName:nil region:currentRegion regionTriggersOnce:YES category:@"test"];
          // set localNotification
  CLLocationCoordinate2D coordinate2D;
  coordinate2D.latitude = 100.0;
  coordinate2D.longitude = 100.0;
  CLRegion *currentRegion =
      [[CLCircularRegion alloc] initWithCenter:coordinate2D
                                        radius:CLLocationDistanceMax
                                    identifier:@"test"];
 
  [APService setLocalNotification:[NSDate dateWithTimeIntervalSinceNow:120]
                        alertBody:@"test ios8 notification"
                            badge:0
                      alertAction:@"取消"
                    identifierKey:@"1"
                         userInfo:nil
                        soundName:nil
                           region:currentRegion
               regionTriggersOnce:YES
                         category:@"test"];

        
This code block in the floating window

iOS 8 UIUserNotificationSettings

Support version

The v1.8.0 version is available.

Client Settings

Use UIUserNotificationCategory

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {NSMutableSet *categories = [NSMutableSet set]; UIMutableUserNotificationCategory *category = [[UIMutableUserNotificationCategory alloc] init]; category.identifier = @"identifier"; UIMutableUserNotificationAction *action = [[UIMutableUserNotificationAction alloc] init]; action.identifier = @"test2"; action.title = @"test"; action.activationMode = UIUserNotificationActivationModeBackground; action.authenticationRequired = YES; //YES is shown in red and NO is shown in blue action.destructive = NO; NSArray *actions = @[action]; [category setActions:actions forContext:UIUserNotificationActionContextMinimal]; [categories addObject:category]; }
          if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {NSMutableSet *categories = [NSMutableSet set];
 
 UIMutableUserNotificationCategory *category = [[UIMutableUserNotificationCategory alloc] init];
 
 category.identifier = @"identifier";
 
 UIMutableUserNotificationAction *action = [[UIMutableUserNotificationAction alloc] init];
 
 action.identifier = @"test2";
 
 action.title = @"test";
 
 action.activationMode = UIUserNotificationActivationModeBackground;
 
 action.authenticationRequired = YES;
 
 //YES is shown in red and NO is shown in blue
 action.destructive = NO;
 
 NSArray *actions = @[action];
 
 [category setActions:actions forContext:UIUserNotificationActionContextMinimal];
 
 [categories addObject:category];
}

        
This code block in the floating window

Use UIUserNotificationType

if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {[APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:categories]; }else{[APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil]; }
          if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {[APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)                      categories:categories];
}else{[APService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)                      categories:nil];
}

        
This code block in the floating window

Use callback functions

// Called when your app has been activated by the user selecting an action from // a remote notification. // A nil action identifier indicates the default action. // You should call the completion handler as soon as you've finished handling // the action. - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {}
          // Called when your app has been activated by the user selecting an action from
// a remote notification.
// A nil action identifier indicates the default action.
// You should call the completion handler as soon as you've finished handling
// the action.
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo
  completionHandler:(void (^)())completionHandler {}

        
This code block in the floating window

Server side Settings

Server content formats: aps increase category field, when the field match with client UIMutableUserNotificationCategory identifier, trigger the action of setting and display button.

payload example: {"aps":{"alert":"example", "sound":"default", "badge": 1, "category":"identifier"}}
          payload example:
{"aps":{"alert":"example", "sound":"default", "badge": 1, "category":"identifier"}}

        
This code block in the floating window

iOS 7 Background Remote Notification

The biggest push change in iOS 7 is the ability to run a piece of code in the background after an app receives a notification, which can be used to get updates from the server. Application scenarios: (Multimedia) chat, Email update, and notification based subscription content synchronization, improving user experience.

Remote Notifications vs. previous releases can be seen in the two official Apple images below.

If only content-available: 1 is carried without any badge, sound, and message content parameters, operations such as content updates can be performed without disturbing the user, which are called "Silent Remote Notifications".

Client Settings

Enable Remote notifications

You need to modify the Capabilities of your app in Xcode to enable Remote notifications. See the image below:

Modify the notification handler

When registered in Backgroud Modes -> Remote notifications, the notification handler switches to the following function, where the background push code is also invoked.

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
          - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;

        
This code block in the floating window

Server push Settings

Push messages carry content-available: 1 as a required parameter for Background running. If this field is not carried, it is the same as normal push messages before iOS7.

Push by using the Web Portal

In Optional Settings, select related parameters.

Using API push

Simply append the content-available":true field in Push API ios (support later)

Limitations and Attention

  • "Silent Remote Notifications" are those with unspecified frequency controls within Apple's limitations. So not all "Silent Remote Notifications" reach the client-side trigger function as intended.
  • The runtime window provided to the application under "Background" is limited. If you need to download larger files, please refer to Apple's NSURLSession introduction.
  • Background Remote Notification requires the client to be in Background or Suspended state, If the user kills the application from the background via App Switcher, the application will not wake up to process the background code.

For more detailed instructions, please refer to Apple's official iOS development documentation.

在文档中心打开
icon
Contact Sales