gpt4 book ai didi

ios - 在 iOS 7 上集成 PushWoosh 未订阅 pushwoosh

转载 作者:行者123 更新时间:2023-11-28 22:00:42 25 4
gpt4 key购买 nike

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

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

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

最佳答案

终于找到方法了。它现在工作。我从他们网站的教程中获得了代码。

所以我正在写步骤。

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

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

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

enter image description here

第 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");

}

关于ios - 在 iOS 7 上集成 PushWoosh 未订阅 pushwoosh,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25182023/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com