Problem sorted..!! Actually the problem was, I had "USE SIDE SWITCH TO:" option in the Settings->General set to "Mute". I set that option to "Lock Rotation" and got rid of my problem. I found a related post here discussions.apple.com/thread/5366534
ios cannot perform text to speech conversion
-
23-09-2022 - |
Question
I am new to iOS development. I want to perform a simple text to speech conversion within app. Following is my code:
AVSpeechSynthesizer *speechSynthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:@"Test text to speech conversion"];
[utterance setRate:1.1f];
[speechSynthesizer speakUtterance:utterance];
The above code is not giving me any exception but its not working at all. I've tried multiple APIs given on GitHub but nothing worked for me. Could anybody tell me where I might be going wrong? Do I have to make any settings on device?
La solution 2
Autres conseils
It's not working because of the Mute
mode of your phone. To turn 'Mute On' in iOS 7, you have to follow the following steps:
- Go to your
Setting
option - Go to
Accessibility
- Go to
AssistiveTouch
- Turn on
AssistiveTouch
option from the switch button - Then a Moving Assistive icon, will appear on you device screen.
- Touch on it to expand with more options
- From there select
Device
and TouchUn mute
option.
Now run the project and hope it will work.
P.S: (In iOS 8.0 this code wouldn't work, because for an unexpected bug, from iOS8.1 they remove it and it is now working perfectly) Hope it works. :)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow