Firebase通知没有进入我的iPhone6

时间:2017-02-06 09:33:39

标签: ios iphone xcode firebase firebase-cloud-messaging

我在我的应用程序中实现了firebase通知。它在我的iPhone5中工作正常。 iPhone5和iPhone6都使用相同的操作系统版本(10.2.1)。 我正在从firebase仪表板发送通知消息。 请帮我解决这个问题?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
      [APBConfiguration configuration];

      if( SYSTEM_VERSION_LESS_THAN( @"10.0" ) )
{
    [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound |    UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
    [[UIApplication sharedApplication] registerForRemoteNotifications];        
}
else
{
    UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
    center.delegate = self;
    [center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
     {
         if( !error )
         {
             [[UIApplication sharedApplication] registerForRemoteNotifications];  
         }
         else
         {

         }  
     }];  
  }
}


- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

    NSLog(@"Device Token :%@",deviceToken);
 }

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {

     NSLog(@"Unable to register for remote notifications: %@", error);
 }

0 个答案:

没有答案
相关问题