在iOS 7集成PushWoosh没有得到认购的pushwoosh [英] Integrating PushWoosh on iOS 7 not getting subscribed on pushwoosh
问题描述
正如前面提到的在其网站上的3个步骤
步骤1 - 推NotificationsSDK添加到您的项目(完成)
第2步 - 在Info.plist中你Pushwoosh ID添加以下关键Pushwoosh_APPID
第3步 - 添加低于code在应用程序委托
块引用>#进口PushNotificationManager.h - (无效)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary的*)pushNotification {
的NSLog(@收到推送通知);
}我做了这三个简单的步骤,但我没有订阅我的PushWoosh应用程序。
谁能告诉我,如果我忘了做任何步骤。解决方案终于让我找到的方式。其现在的工作。我得到了code从他们的网站的教程。
所以,我写的步骤。
步骤1 - 推NotificationsSDK添加到项目
第2步 - 在Info.plist中你Pushwoosh ID添加以下关键Pushwoosh_APPID
第3步 - 添加-ObjC和-all_load其他连接器选项。 (如下例)。
第4步 - 添加低于code在AppDelegate.h
**#导入Pushwoosh / PushNotificationManager.h**@interface AppDelegate中:UIResponder< UIApplicationDelegate,** PushNotificationDelegate **指
第5步 - 添加低于code在AppDelegate.m
- (BOOL)应用:(*的UIApplication)的应用didFinishLaunchingWithOptions:(NSDictionary的*)launchOptions
{
//你的另一code[PushNotificationManager pushManager] .delegate =自我;[PushNotificationManager pushManager] handlePushReceived:launchOptions];[PushNotificationManager pushManager] sendAppOpen][PushNotificationManager pushManager] registerForPushNotifications]
}
下面给出代表推送通知
- (无效)应用:(*的UIApplication)的应用didRegisterForRemoteNotificationsWithDeviceToken:(NSData的*)deviceToken {
[PushNotificationManager pushManager] handlePushRegistration:deviceToken];
} - (无效)应用:(*的UIApplication)的应用didFailToRegisterForRemoteNotificationsWithError:(NSError *)错误{
[PushNotificationManager pushManager] handlePushRegistrationFailure:错误]
} - (无效)应用:(*的UIApplication)的应用didReceiveRemoteNotification:(NSDictionary的*){用户信息
[PushNotificationManager pushManager] handlePushReceived:用户信息];
} - (无效)应用:(*的UIApplication)的应用didReceiveRemoteNotification:(NSDictionary的*)USERINFO fetchCompletionHandler:(无效(^)(UIBackgroundFetchResult)){completionHandler
*的NSDictionary = pushDict [USERINFO objectForKey:@APS];
BOOL isSilentPush = [[pushDict objectForKey:@内容提供] boolValue];如果(isSilentPush){
的NSLog(@无声推送通知:%@,用户信息); //加载内容点击这里 //必须调用completionHandler
completionHandler(UIBackgroundFetchResultNewData);
}
其他{
[PushNotificationManager pushManager] handlePushReceived:用户信息]; //必须调用completionHandler
completionHandler(UIBackgroundFetchResultNoData);
}
}
- (无效)onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary的*)pushNotification
{
的NSLog(@收到推送通知); }As Mentioned on Their Site 3 steps
Step 1 - Add Push NotificationsSDK to your project (Done)
Step 2 - In Info.plist add the following key Pushwoosh_APPID with your Pushwoosh id
Step 3 - Add below code in App delegate
#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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!