首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >集成PushWoosh在iOS 7上,没有在pushwoosh上获得订阅

集成PushWoosh在iOS 7上,没有在pushwoosh上获得订阅
EN

Stack Overflow用户
提问于 2014-08-07 12:03:16
回答 2查看 700关注 0票数 0

正如在他们的站点上提到的,3步

步骤1-向项目中添加Push NotificationsSDK (已完成) 步骤2-在Info.plist中使用Pushwoosh id添加以下Pushwoosh_APPID键 步骤3-在App委托中添加下面的代码

代码语言:javascript
复制
#import "PushNotificationManager.h

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

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-08-09 10:45:54

终于找到了路。现在起作用了。我从他们网站的教程中得到了代码。

所以我在写步骤。

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

步骤2-在Info.plist中使用Pushwoosh id添加以下Pushwoosh_APPID键

步骤3-在其他链接器标志中添加-ObjC和-all_load。(除下文外)。

步骤4-在AppDelegate.h中添加下面的代码

代码语言:javascript
复制
 **#import "Pushwoosh/PushNotificationManager.h"**

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

步骤5-在AppDelegate.m中添加下面的代码

代码语言:javascript
复制
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

代码语言:javascript
复制
//Your Other Code

[PushNotificationManager pushManager].delegate = self;

[[PushNotificationManager pushManager] handlePushReceived:launchOptions];

[[PushNotificationManager pushManager] sendAppOpen];

[[PushNotificationManager pushManager] registerForPushNotifications];

}

提供以下推送通知的代表

代码语言:javascript
复制
 - (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");

  }
票数 2
EN

Stack Overflow用户

发布于 2014-08-08 05:45:37

如果您的设备通过WiFi连接到互联网,并且消息无法通过该设备,请确保APN端口不会被防火墙阻塞。推送提供商、iOS设备和Mac计算机通常都在防火墙后面。要发送通知,需要允许端口2195上的入站和出站TCP数据包。通过will连接到推送服务的设备和计算机将需要允许端口5223上的入站和出站TCP数据包。

推送服务的IP地址范围可能会发生变化;预计提供者将使用主机名而不是IP地址进行连接。push服务使用负载平衡方案,为同一主机名生成不同的IP地址。但是,整个17.0.0.0/8地址块分配给Apple,因此您可以在防火墙规则中指定该范围。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25182023

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档