---
sourceDocument: Référence API Brésil
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/api-reference

 Release :

    - brazil

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence API Brésil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Protocole NowChatServiceDelegate : iOS

# Protocole NowChatServiceDelegate : iOS {#ariaid-title1}

Rversion finale: Brazil  
Mis à jour 10 sept. 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes de lecture  
Le protocole NowChatServiceDelegate fournit des rappels pour la notification d'actions dans NowChatService telles qu'une demande d'ouverture d'une URL ou le rejet du contrôleur de vue de messagerie instantanée.

## NowChatServiceDelegate : chatService(_chatService : NowChatService, didRequestOpenUrlurl : URL) {#ariaid-title2}

Rappel qui notifie l'application hôte que le service de messagerie instantanée spécifié a reçu une demande d'ouverture d'URL. Ce rappel est généralement déclenché par un utilisateur qui appuie sur un lien dans l'interface utilisateur de messagerie instantanée. Il incombe à l'application hôte de gérer l'ouverture de l'URL ou d'ignorer la demande.
{#NCSD-chatService_O_S__table_alb_31w_wqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| chatService (messagerie instantanée) | [NowChatService](https://servicenow-prod.fluidtopics.net/hK8psro0Q9nMQK9_F9GpSA#NowChatServiceiOSAPI "La classe NowChatService fournit des options virtuelles et Agent actif de messagerie instantanée.") | Objet NowChatService effectuant la demande. |
| didRequestOpenUrl url | URL | URL que le service a demandé d'ouvrir. |
[Tableau 1. Paramètres]

{#NCSD-chatService_O_S__table_alb_31w_wqb} {#NCSD-chatService_O_S__table_blb_31w_wqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 2. Renvoie]

{#NCSD-chatService_O_S__table_blb_31w_wqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    func chatService(_ chatService: NowChatService, didRequestOpenUrl url: URL) {
      var updatedViewState = makeViewState()
      updatedViewState.urlToOpen = url
      viewState = updatedViewState
    }

## NowChatServiceDelegate : chatService(_ chatService : NowChatService, systemThemeDidChange, traitCollection : UITraitCollection) {#ariaid-title3}

Rappel qui notifie l'application hôte que le thème de la messagerie instantanée système a changé.
{#NCSD-chatService_O_B_O__table_uhw_s1w_x2c__entry__3}

| Nom | Type | Description |
|-|-|-|
| chatService (messagerie instantanée) | [NowChatService](https://servicenow-prod.fluidtopics.net/hK8psro0Q9nMQK9_F9GpSA#NowChatServiceiOSAPI "La classe NowChatService fournit des options virtuelles et Agent actif de messagerie instantanée.") | Objet NowChatService effectuant la demande. |
| traitCollection | [UITraitCollection](https://developer.apple.com/documentation/uikit/uitraitcollection) | UITraitCollection contenant le nouveau thème. |
[Tableau 3. Paramètres]

{#NCSD-chatService_O_B_O__table_uhw_s1w_x2c} {#NCSD-chatService_O_B_O__table_vhw_s1w_x2c__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 4. Renvoie]

{#NCSD-chatService_O_B_O__table_vhw_s1w_x2c}  
L'exemple de code suivant montre comment remplacer la fonction de délégué systemThemeDidChange() pour appeler la fonction updateTheme() afin d'appliquer des changements de thème lorsque le thème système change.

    func chatService(_ chatService: any SnowChat.ChatServiceProvider, systemThemeDidChange traitCollection: UITraitCollection) {

      /// The corresponding updateTheme() method can be called here to change the UI theme based on System Theme
      chatService.updateTheme(theme: traitCollection.userInterfaceStyle == .dark ? DarkNowChatTheme() : LightNowChatTheme())
      print("System Theme Did Change)
    }

## NowChatServiceDelegate : chatServiceViewControllerWasDismissed(_chatService : NowChatService) {#ariaid-title4}

Rappel qui informe l'application hôte que le contrôleur de vue de messagerie instantanée a été rejeté.
{#NCSD-chatServiceViewContDismiss_O__table_vs4_qbw_wqb__entry__3}

| Nom | Type | Description |
|-|-|-|
| chatService (messagerie instantanée) | [NowChatService](https://servicenow-prod.fluidtopics.net/hK8psro0Q9nMQK9_F9GpSA#NowChatServiceiOSAPI "La classe NowChatService fournit des options virtuelles et Agent actif de messagerie instantanée.") | Objet NowChatService dont le contrôleur de vue a été rejeté. |
[Tableau 5. Paramètres]

{#NCSD-chatServiceViewContDismiss_O__table_vs4_qbw_wqb} {#NCSD-chatServiceViewContDismiss_O__table_ws4_qbw_wqb__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 6. Renvoie]

{#NCSD-chatServiceViewContDismiss_O__table_ws4_qbw_wqb}  
L'exemple de code suivant montre comment appeler cette fonction.

    func chatServiceViewControllerWasDismissed(_ chatService: NowChatService) {
      resetChat()
    }

## NowChatServiceDelegate : didEndSessionWithId(sessionId : chaîne) {#ariaid-title5}

Appelé lorsque l'écran de messagerie instantanée est fermé et que la session de messagerie instantanée se termine.
Remarque :  
Vous pouvez définir la fonctionnalité souhaitée pour ce rappel en remplaçant la fonction.
{#NCSD-didEndSessionWId_S__table_j1t_hv2_52c__entry__3}

| Nom | Type | Description |
|-|-|-|
| sessionId | Chaîne | Sys_id de la session qui s'est terminée. Table : Session de conversation \[sys_cs_session\] |
[Tableau 7. Paramètres]

{#NCSD-didEndSessionWId_S__table_j1t_hv2_52c} {#NCSD-didEndSessionWId_S__table_k1t_hv2_52c__entry__2}

| Type | Description |
|-|-|
| Aucune |   |
[Tableau 8. Renvoie]

{#NCSD-didEndSessionWId_S__table_k1t_hv2_52c}  
L'exemple de code suivant montre où placer votre code pour remplacer la fonctionnalité par défaut.

    func chatService(_ chatService: NowChatService, didEndSessionWithId sessionId: String) {
      print("Chat Session ended with ID: \(sessionId)")
    }


