我们已使用这些guidelines集成了Urban SDK。
我们尝试使用ad hoc配置文件检查推送通知,我们在 AirshipConfig.plist
中设置了以下值inProduction=YES
productionAppKey=OUR PRODUCTION KEY
productionAppSecret= OUR PRODUCTION 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];
}
当我们尝试将通知发送到已注册的设备令牌时,服务器会将设备令牌显示为 INACTIVE 设备令牌。
请告诉我我应该为此做些什么。
答案 0 :(得分:0)
所以,首先看起来你错过了一些应用delegate methods。
Urban Airship处理APNS注册。删除手动注册呼叫,因为UA会覆盖它们,而是启用[UAirship push].userPushNotificationsEnabled = YES;
的通知。它应该提示用户接受通知,然后应选择城市飞艇频道。