在 iOS 7 上集成 PushWoosh 未在 pushwoosh 上订阅 [英] Integrating PushWoosh on iOS 7 not getting subscribed on pushwoosh

查看:33
本文介绍了在 iOS 7 上集成 PushWoosh 未在 pushwoosh 上订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如他们网站上提到的 3 个步骤

As Mentioned on Their Site 3 steps

第 1 步 - 将 Push NotificationsSDK 添加到您的项目(完成)

Step 1 - Add Push NotificationsSDK to your project (Done)

第 2 步 - 在 Info.plist 中添加以下键 Pushwoosh_APPID 和您的 Pushwoosh id

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

第 3 步 - 在 App 委托中添加以下代码

Step 3 - Add below code in App delegate

#import "PushNotificationManager.h

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

我完成了所有这三个简单的步骤,但我没有在 PushWoosh 上订阅我的应用程序.如果我忘记执行任何步骤,任何人都可以告诉我.

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.

所以我正在编写步骤.

步骤 1 - 将 Push NotificationsSDK 添加到您的项目

Step 1 - Add Push NotificationsSDK to your project

第 2 步 - 在 Info.plist 中添加以下键 Pushwoosh_APPID 和您的 Pushwoosh id

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

步骤 3 - 在其他链接器标志中添加 -ObjC 和 -all_load.(例如下面).

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

第 4 步 - 在 AppDelegate.h 中添加以下代码

Step 4 - Add below code in AppDelegate.h

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

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

第 5 步 - 在 AppDelegate.m 中添加以下代码

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 上订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆