用户选择允许推送通知后,在Setting.app中关闭推送通知开关

时间:2018-03-31 07:01:06

标签: ios push-notification apple-push-notifications

有没有人出现这个问题?它应该只是UI显示问题吗?我的意思是Setting.app用户界面没有自己刷新它。

我们的“注册通知中心”代码如下:

    UNUserNotificationCenter* center = [UNUserNotificationCenter currentNotificationCenter];
    center.delegate = self;
    [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge)
                          completionHandler:^(BOOL granted, NSError * _Nullable error) {

                              if (granted) {
                                  dispatch_async(dispatch_get_main_queue(), ^{
                                      [[UIApplication sharedApplication] registerForRemoteNotifications];
                                  });
                                  if (![FBYPreferences instance].hasRequestAuthorizationForNotification) {
                                      [Taplytics logEvent:@"Accept Notification number" value:@(1) metaData:nil];
                                  }
                              }else {
                                  [TrackerHelper doTrackEvent:@"Notifiction Not Granted" withCategory:@"Notifiction" withLabel:@""];
                                  if (![FBYPreferences instance].hasRequestAuthorizationForNotification) {
                                      [Taplytics logEvent:@"Decline Notification number" value:@(1) metaData:nil];
                                  }
                              }
                              [FBYPreferences instance].hasRequestAuthorizationForNotification = YES;
                          }];

我看看这些代码并认为它​​没问题。我们的PM表示他们在Setting.app。

中看到开关关闭后无法收到推送通知

你有什么建议吗?你的想法可以解决它,我会非常感激。

更新:我们在应用启动时调用上述代码两次。这可能是原因吗?我们删除重复的方法调用,只调用一次。

0 个答案:

没有答案
相关问题