大佬教程收集整理的这篇文章主要介绍了didRegisterForRemoteNotificationsWithDeviceToken未在ios8中调用,但是已经注册了…,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
文件说:
这是AppDelegate中的代码(应用程序版本是8.1):
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //register notif UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound); UIUserNotificationSetTings *setTings = [UIUserNotificationSetTings setTingsForTypes:userNotificationTypes categories:nil]; [application registerUserNotificationSetTings:setTings]; return YES; } - (void)application:(UIApplication *)application didRegisterUserNotificationSetTings:(UIUserNotificationSetTings *)notificationSetTings { //register to receive notifications [application registerForRemoteNotifications]; NSLog(@"didRegisterUser"); } -(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error { NSLog(@"error here : %@",error);//not called } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviCEToken:(NSData *)deviCEToken { /* // Store the deviCEToken in the current installation and save it to Parse. PFInstallation *currenTinstallation = [PFInstallation currenTinstallation]; [currenTinstallation setDeviCETokenFromData:deviCEToken]; currenTinstallation.chAnnels = @[ @"global" ]; [currenTinstallation saveInBACkground]; */ NSLog(@"did register notif");//not called }
我也有背景模式 – > info.plist中的远程通知.
- (void)application:(UIApplication *)application didRegisterUserNotificationSetTings:(UIUserNotificationSetTings *)notificationSetTings { if (notificationSetTings.types != UIUserNotificationTypeNonE) { NSLog(@"didRegisterUser"); [application registerForRemoteNotifications]; } }
可能存在导致APN注册失败的配置问题.
>确保您的配置配置文件包含aps环境条目>确保您的配置配置文件中设置了唯一的应用标识符(不包含任何“*”的字符串).您还应该在Info.plist中将此确切标识符用作“捆绑标识符”>也许您在初次安装后拒绝了推送功能 – 在这种情况下,您将永远不会再看到应用内推送警报,并且必须再次启用“设置”应用.>尝试另一个设备.
以上是大佬教程为你收集整理的didRegisterForRemoteNotificationsWithDeviceToken未在ios8中调用,但是已经注册了…全部内容,希望文章能够帮你解决didRegisterForRemoteNotificationsWithDeviceToken未在ios8中调用,但是已经注册了…所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。