gpt4 book ai didi

ios - iOS 中的 Urban Airship SDK 集成和推送通知

转载 作者:可可西里 更新时间:2023-11-01 06:14:12 25 4
gpt4 key购买 nike

我们已经使用这些 guidelines 集成了 Urban SDK .

我们已尝试使用我们在 AirshipConfig.plist 中设置以下值的临时配置文件检查推送通知

  • inProduction=YES
  • productionAppKey=OUR PRODUCTION KEY
  • productionAppSecret= 我们的生产 secret

请检查我们在项目的 AppDelegate 文件中实现的以下代码。


-(void) applicationDidFinishLaunching: (UIApplication *)application
{
.
.
.
.
UAConfig *config = [UAConfig defaultConfig];
config.automaticSetupEnabled=NO;
[UAirship takeOff:config];

if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)])
{
NSLog(@"------------REGISTER DEVICE------------: >= 8");
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
}
else
{
NSLog(@"------------REGISTER DEVICE------------: <8 ");
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
.
.
.
.

}

#pragma mark Remote Notification methods


-(void) application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken // Device Registration
{
[[UAirship push] appRegisteredForRemoteNotificationsWithDeviceToken:devToken];

}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings
{
[[UAirship push] appRegisteredUserNotificationSettings];

}
-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"%@", error);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
NSLog(@"NOTIFICATION------------ didReceiveRemoteNotification ------------ %@", userInfo);
[[UAirship push] appReceivedRemoteNotification:userInfo applicationState:application.applicationState];
}

当我们尝试向已注册的设备 token 发送通知时,服务器将该设备 token 显示为INACTIVE设备 token 。

告诉我我应该为此做什么。

最佳答案

所以,首先看起来您缺少一些应用 delegate methods .

Urban Airship 处理 APNS 注册。删除您的手动注册调用,因为 UA 只会覆盖它们,而是使用 [UAirship push].userPushNotificationsEnabled = YES; 启用通知;。它应提示用户接受通知,然后应选择加入 Urban Airship channel 。

关于ios - iOS 中的 Urban Airship SDK 集成和推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31959344/

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