在iOS 7上集成PushWoosh不会在pushwoosh上订阅

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

第1步 – 将推送通知SDK添加到您的项目(完成)

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

第3步 – 在App代理中添加以下代码

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

我做了所有这三个简单的步骤,但我没有订阅我的应用程序在PushWoosh。 任何人都可以告诉我,如果我忘了做任何步骤。

最后我find了方法。 现在正在工作。 我从他们的网站的教程得到的代码。

所以我正在写这些步骤。

第1步 – 将推送通知SDK添加到您的项目

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

第3步 – 在其他链接器标志中添加-ObjC和-all_load。 (如下)。

在这里输入图像说明

第4步 – 在AppDelegate.h中添加下面的代码

  **#import "Pushwoosh/PushNotificationManager.h"** @interface AppDelegate : UIResponder <UIApplicationDelegate,**PushNotificationDelegate**> 

第5步 – 在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]; 

}

给出下面推送通知的代表

  - (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"); } 

如果您的设备通过WiFi连接到互联网,并且消息没有连接到设备,请确保APN端口不被防火墙阻挡。 推送提供商,iOS设备和Mac电脑通常位于防火墙之后。 要发送通知,您需要允许通过端口2195的入站和出站TCP数据包。通过Wi-Fi连接到推送服务的设备和计算机将需要通过端口5223允许入站和出站TCP数据包。

推送服务的IP地址范围可能会更改; 期望的是提供者将通过主机名而不是IP地址来连接。 推送服务使用负载均衡scheme,为同一主机名生成不同的IP地址。 但是,整个17.0.0.0/8地址块已分配给Apple,因此您可以在防火墙规则中指定该范围。