Comment désactiver la vue d'alerte de notification par défaut sur les notifications à distance iOS?

Dans mon application, j'ai activé les notifications à distance,

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

Et j'ai implémenté les methods de délégué comme suit,

 - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{ NSLog(@"Failed!!"); } - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { // Print message. if (userInfo) { NSLog(@"Message ID: %@", userInfo); } completionHandler(UIBackgroundFetchResultNoData); } 

Mais quand l'application est au premier plan et reçoit une notification, j'ai un UIAlertView avec le titre et le message de notification. je veux

 //Called when a notification is delivered to a foreground app. -(void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler{ NSLog(@"User Info : %@",notification.request.content.userInfo); completionHandler(UNAuthorizationOptionSound | UNAuthorizationOptionBadge); } //Called to let your app know which action was selected by the user for a given notification. -(void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler{ NSLog(@"User Info : %@",response.notification.request.content.userInfo); completionHandler(); } 

J'ai débogué sur willPresentNotification: et après ce triggersurs j'ai eu l'alerte. Et j'ai testé en supprimant cette méthode aussi. Mais cette alerte est toujours visible lors de la réception d'une notification.

Comment puis-je désactiver cette vue d'alerte? J'utilise 10.2 iOS dans mon iPhone

entrez la description de l'image ici

Je ne pense pas que le UIAlertController provienne de notifications. Êtes-vous sûr de ne pas en créer un ailleurs?

L'implémentation de vos notifications semble correcte.

Pouvez-vous chercher dans votre projet et utiliser des points d'arrêt pour voir si l'un de vos UIAlertController est touché?