user3125704
user3125704

Reputation: 49

SpeechSynthesizer error in 'await' in windows phone 8

I receive an error in SpeechSynthesizer, it says:

Error: 'await' requires that the type 'Windows.Foundation.IAsynAction' have a suitable GetAwaiter method. Are you missing directive for 'System'?

I use plain text, my code goes like this

await synth.SpeakTextAsync(titleTextBox.Text);

Upvotes: 1

Views: 165

Answers (1)

ROMAN
ROMAN

Reputation: 1576

Add async keyword to the method header.

    private async void MethodName()
    {
        var synth = new SpeechSynthesizer();
        await synth.SpeakTextAsync(titleTextBox.Text);
    }

Upvotes: 1

Related Questions