
我们尝试使用ad hoc配置文件检查推送通知,我们在AirshipConfig.pList中设置了以下值
> inProduction = YES
> productionAppKey =我们的生产关键
> productionAppSecret =我们的生产秘密
请检查我们在项目的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设备令牌.
请告诉我该怎么办.
解决方法 所以,首先看起来你错过了一些app delegate methods.Urban Airship处理APNS注册.删除您的手动注册呼叫,因为UA将覆盖它们,而是通过[UAirship push] .userPushNotificationsEnabled = YES;启用通知.它应该提示用户接受通知,然后应该选择Urban Airship频道.
总结以上是内存溢出为你收集整理的iOS中的Urban Airship SDK集成和推送通知全部内容,希望文章能够帮你解决iOS中的Urban Airship SDK集成和推送通知所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)