Updating the iOS SDK

 Recently we improved significantly the iOS SDK integration process. Although the new method of integration is much simpler, if you currently are using an older version and are wishing to update, there are a few changes that you will have to make.

New XPush.framework

Import the new iOS SDK (which can be found here). The SDK is now distributed as a .framework instead of a static library. 
The changes you should make to your project are:

  • Remove the older XPush.h and XPush.a files from your project
  • Extract the XPush.framework from the zip file.
  • Drag and drop the XPush framework into your project.
  • Make sure XPush.framework appears on the frameworks section of your target


Bridging Header

If your app is a swift app, please remove the #import "XPush.h" line from your bridging header. 

You can now import XPush like any other Swift module.


In this version we have implemented a default UNUserNotificationCenter. So if you have implemented this elsewhere, we recommend that you remove it. If it is necessary that you keep it, please contact support.


Universal Notification Options

NotificationTypes have been improved to work with a universal notification type (XPNotificationType) rather than different types for different versions.

old way

NSInteger types;

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.f) {
    types = UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound;
} else {
    types = UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeBadge;

[XPush registerForRemoteNotificationTypes:types];


New way

[XPush registerForRemoteNotificationTypes:XPNotificationType_Alert | 
    XPNotificationType_Sound | XPNotificationType_Badge];


Delegate Function Changes

A change has been made from using didRecieveRemoteNotification. You must change this function to the following.

old way 

func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {

new way

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

    [XPush applicationDidReceiveRemoteNotification:userInfo


Custom Message Handling

In previous versions custom message handling was possible with regards to notifications, but now allows for all message types.

To changeover to the new functionality you should first remove any custom logic you added to the didReceiveRemoteNotification app.delegate function.

Now register the new callback like the following:

[XPush registerMessageResponseHandler:^(XPMessageResponse *response) {
    switch (response.action.type) {
        case XPActionType_Click:
            // Logic when message is clicked
        case XPActionType_Dismiss:
            // Logic when message is dismissed
        case XPActionType_Present:
            // Logic when message is received in foreground

More details on this new callback can be found here. 


Additional New Features:


Additional control options have been implemented to allow for more customised behaviour when a push notification is received.  

More information on this feature can be found here.



Xtremepush customers now have the option of adding multiple buttons to interactive notifications. 

To set up your interactive notification campaign on the platform see here.

To see how you can handle the individual button clicks, see here.

















Have more questions? Submit a request


Article is closed for comments.