<!--
{
  "availability" : [
    "macOS: 10.5.0 - 14.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSpeechSynthesizerDelegate/speechSynthesizer(_:didEncounterSyncMessage:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSpeechSynthesizerDelegate(im)speechSynthesizer:didEncounterSyncMessage:"
  },
  "title" : "speechSynthesizer(_:didEncounterSyncMessage:)"
}
-->

# speechSynthesizer(_:didEncounterSyncMessage:)

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

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

## Parameters

`sender`

Speech synthesizer informing its delegate of an error.

`message`

Error message.

## 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:)`](/documentation/AppKit/NSSpeechSynthesizerDelegate/speechSynthesizer(_:willSpeakPhoneme:)) and [`speechSynthesizer(_:willSpeakWord:of:)`](/documentation/AppKit/NSSpeechSynthesizerDelegate/speechSynthesizer(_:willSpeakWord:of:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)