Question

I am trying to implement Push notifications on my iOS app using PushWoosh. However, their tutorial...there's no nice way to say it. Their tutorial is awful. It just stinks. It is simply the worst. Here is the entire tutorial steps:

  1. For the truly seamless integration all you have to do is to simply add Push NotificationsSDK to your project!

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

  3. To handle push notifications add the following function to your App Delegate.m file

     #import "PushNotificationManager.h"

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

That’s it! Easy, isn’t it?

Wow, that was easy. Except for a few minor things....it's an empty method! There's nothing there inside the method. No calls for how to register it with the service, nothing! Does someone have some experience in what all needs to be coded to set this up properly? Even their sample app has nothing in the App Delegate to reference this.

Was it helpful?

Solution 3

Here is what was left out. In the didFinishLaunchingWithOptions method, you need to add:

 [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    pushManager = [[PushNotificationManager alloc] initWithApplicationCode:@"YOUR_APP_ID" appName:@"YOUR_APP_NAME"];
    pushManager.delegate = self;
    [pushManager handlePushReceived:launchOptions];

Then, you also need these methods in the AppDelegate.m

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
    [pushManager handlePushRegistration:devToken];
  }

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)pushMessage
{
    [pushManager handlePushReceived:pushMessage];
}

OTHER TIPS

The SDK handles the registration and everything automatically using the powers of Objective-C runtime. You only need to pass -ObjC flag to the linker (this is VERY important step).

It looks like the easiest way sometimes confuses developers more than "hard and painful".

Thank you for your feedback and we will provide better documentation!

Pushwoosh team

I just bumped into this recently myself and thought I'd add my results here. For myself at least, the reason that the linker flag was not working was that I had set it under the Project, instead of setting it on the Target. After switching it to the Target, it began to register the device as advertised.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top