J'essaie de déclencher une notification locale lorsque je reçois une notification push à distance (VoIP PushKit) qui démarre mon application en arrière-plan.Est-il possible de déclencher des notifications locales lorsque l'application iOS 10 est en arrière-plan?
Je vois ma notification locale dans le tableau des notifications en attente au UNUserNotificationCenter.
[[UNUserNotificationCenter currentNotificationCenter] getPendingNotificationRequestsWithCompletionHandler:
^(NSArray<UNNotificationRequest *> * _Nonnull requests)
{
NSLog(@"Local notifications: %@",requests);
}];
"<UNNotificationRequest: 0x17162e500; identifier: 2A364020-3BA2-481B-9255-16EBBF2F4484, content: <UNNotificationContent: 0x1708e8080; title:test, subtitle: (null), body: test2, categoryIdentifier: missed, launchImageName: , peopleIdentifiers: (\n), threadIdentifier: , attachments: (\n), badge: 1, sound: <UNNotificationSound: 0x1704bfe60>, hasDefaultAction: YES, shouldAddToNotificationsList: YES, shouldAlwaysAlertWhileAppIsForeground: YES, shouldLockDevice: YES, shouldPauseMedia: NO, isSnoozeable: NO, fromSnooze: NO, darwinNotificationName: (null), darwinSnoozedNotificationName: (null), trigger: <UNTimeIntervalNotificationTrigger: 0x171624260; repeats: NO, timeInterval: 5.000000>>"
Mais cela n'apparaît pas après 5 sec. J'utilise UNTimeIntervalNotificationTrigger.
J'ai réussi à appeler la notification locale lorsque l'application est au premier plan. J'utilise la même fonction pour le déclenchement en l'appelant en appuyant sur le bouton.
Y at-il un moyen de déclencher une notification locale lorsque l'application iOS est en arrière-plan?