---
title: "speechSynthesizer(_:didEncounterSyncMessage:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsspeechsynthesizerdelegate/speechsynthesizer(_:didencountersyncmessage:)"
---

# speechSynthesizer(_:didEncounterSyncMessage:)

Sent to the delegate when a speech synthesizer encounters a synchronization error.

## Declaration

```swift
@MainActor optional func speechSynthesizer(_ sender: NSSpeechSynthesizer, didEncounterSyncMessage message: String)
```

## Parameters

- `sender`: Speech synthesizer informing its delegate of an error.
- `message`: Error message.

## Discussion

Discussion The synthesizer calls your synchronization delegate method whenever it encounters a synchronization command embedded in a string. You might use the synchronization delegate method to provide a callback not ordinarily provided. For example, you might insert synchronization commands at the end of every sentence in a string, or you might enter synchronization commands after every numeric value in the text. However, to synchronize your application with phonemes or words, it makes more sense to use the built-in phoneme and word delegate methods: speechSynthesizer(_:willSpeakPhoneme:) and speechSynthesizer(_:willSpeakWord:of:).

## See Also

### Synthesizing Speech

- [speechSynthesizer(_:willSpeakWord:of:)](appkit/nsspeechsynthesizerdelegate/speechsynthesizer(_:willspeakword:of:).md)
- [speechSynthesizer(_:willSpeakPhoneme:)](appkit/nsspeechsynthesizerdelegate/speechsynthesizer(_:willspeakphoneme:).md)
- [speechSynthesizer(_:didEncounterErrorAt:of:message:)](appkit/nsspeechsynthesizerdelegate/speechsynthesizer(_:didencountererrorat:of:message:).md)
- [speechSynthesizer(_:didFinishSpeaking:)](appkit/nsspeechsynthesizerdelegate/speechsynthesizer(_:didfinishspeaking:).md)
