本文介绍了在iOS 7集成PushWoosh没有得到认购的pushwoosh的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如前面提到的在其网站上的3个步骤

#import "PushNotificationManager.h

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

I did all these three simple steps but I am not being subscribed to my app on PushWoosh.Can Anyone tell me if I forget to do any steps.

解决方案

Finally i found the way. Its working now. i got the code from tutorial of their site.

So i am writing the steps.

Step 1 - Add Push NotificationsSDK to your project

Step 2 - In Info.plist add the following key Pushwoosh_APPID with your Pushwoosh id

Step 3 - Add -ObjC and -all_load in other linker flags. (ex below).

Step 4 - Add below code in AppDelegate.h

 **#import "Pushwoosh/PushNotificationManager.h"**

@interface AppDelegate : UIResponder <UIApplicationDelegate,**PushNotificationDelegate**>

Step 5 - Add below code in AppDelegate.m

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

//Your Other Code

[PushNotificationManager pushManager].delegate = self;

[[PushNotificationManager pushManager] handlePushReceived:launchOptions];

[[PushNotificationManager pushManager] sendAppOpen];

[[PushNotificationManager pushManager] registerForPushNotifications];

}

Given Below Delegates for Push notifications

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

  - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[[PushNotificationManager pushManager] handlePushRegistrationFailure:error];
 }

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

 - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
NSDictionary *pushDict = [userInfo objectForKey:@"aps"];
BOOL isSilentPush = [[pushDict objectForKey:@"content-available"] boolValue];

if (isSilentPush) {
    NSLog(@"Silent push notification:%@", userInfo);

    //load content here

    // must call completionHandler
    completionHandler(UIBackgroundFetchResultNewData);
}
else {
    [[PushNotificationManager pushManager] handlePushReceived:userInfo];

    // must call completionHandler
    completionHandler(UIBackgroundFetchResultNoData);
}
}


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

  }

这篇关于在iOS 7集成PushWoosh没有得到认购的pushwoosh的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 07:20