Mac OS X Push Notification SDK

Download SDK
Sample Project

To integrate Pushwoosh into your application:

  1. Add Pushwoosh.framework to your project.

  2. In Info.plist add the Pushwoosh_APPID key with your Pushwoosh Application ID string value.

  3. Required code changes:

3.1. Add import definitions to AppDelegate.m.

#import <Pushwoosh/PushNotificationManager.h>

3.2. In the applicationDidFinishLaunching function add:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    //lots of your initialization code
  	[NSUserNotificationCenter defaultUserNotificationCenter].delegate = self;
    //-----------PUSHWOOSH PART-----------
    // set custom delegate for push handling, in our case - view controller
    PushNotificationManager * pushManager = [PushNotificationManager pushManager];
    pushManager.delegate = self;
    // handling push on app start
    [[PushNotificationManager pushManager] handlePushReceived:[aNotification userInfo]];
    // make sure we count app open in Pushwoosh stats
    [[PushNotificationManager pushManager] sendAppOpen];
    // register for push notifications!
    [[PushNotificationManager pushManager] registerForPushNotifications];

3.3. Add the following code to your UIApplicationDelegate (same file as above).

// system push notification registration success callback, delegate to pushManager
- (void)application:(NSApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
	[[PushNotificationManager pushManager] handlePushRegistration:deviceToken];

// system push notification registration error callback, delegate to pushManager
- (void)application:(NSApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
	[[PushNotificationManager pushManager] handlePushRegistrationFailure:error];


// system push notifications callback, delegate to pushManager
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification { notification.userInfo);
	[[PushNotificationManager pushManager] handlePushReceived:notification.userInfo];

3.4. To handle push notifications add the following function to your UIApplicationDelegate (the same file as three steps above)

- (void) onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification onStart:(BOOL)onStart {
    NSLog(@"Push notification received");

3.5 Add libz.dylib to the project:

  • go to Target section
  • open "Build Phases" tab
  • open "Link Binaries With Libraries"
  • click "+"
  • search "libz.dylib"
  • Click Add

Repeat for libstdc++.dylib library.
Note that in Xcode 7 .dylib files have .tbd extension.

All done!

Mac OS X Push Notification SDK