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:
For the truly seamless integration all you have to do is to simply add Push NotificationsSDK to your project!
In your Info.plist add the following key Pushwoosh_APPID with your Pushwoosh Application ID string value
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.
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];
}