[Text-to-Speech Plugin] Error compiling cordova plugin
Forge component by Luís Almeida
Application Type

I got this error when tried to generate iOS
In iOS on 2021-02-18 at 13:22:57 - Error compiling Cordova plugin: /var/lib/builder01/builds/4146d25b-275f-40a8-9f82-316cff814a83/source/platforms/ios/iCansa/Plugins/cordova-plugin-tts/CDVTTS.m.

But its working fine on android

Hi Abdiel,

When you try to generate in IOS with MABS 6.3/7.0 there are 4 errors:

[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:64:19: error: redefinition of 'options'
[VERBOSE] [Build] NSDictionary* options = [command.arguments objectAtIndex:0];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:40:19: note: previous definition is here
[VERBOSE] [Build] NSDictionary* options = [command.arguments objectAtIndex:0];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:66:15: error: redefinition of 'text'
[VERBOSE] [Build] NSString* text = [options objectForKey:@"text"];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:42:15: note: previous definition is here
[VERBOSE] [Build] NSString* text = [options objectForKey:@"text"];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:67:15: error: redefinition of 'locale'
[VERBOSE] [Build] NSString* locale = [options objectForKey:@"locale"];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:43:15: note
[VERBOSE] [Build] : previous definition is here
[VERBOSE] [Build] NSString* locale = [options objectForKey:@"locale"];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:68:12: error: redefinition of 'rate'
[VERBOSE] [Build] double rate = [[options objectForKey:@"rate"] doubleValue];
[VERBOSE] [Build] ^
[VERBOSE] [Build] /var/lib/builder02/builds/58ed0d18-7a43-47c2-95a9-b7683540f752/source/platforms/ios/TextToSpeechDemo/Plugins/cordova-plugin-tts/CDVTTS.m:44:
[VERBOSE] [Build] 12: note: 
[VERBOSE] [Build] previous definition is here
[VERBOSE] [Build] double rate = [[options objectForKey:@"rate"] doubleValue];
[VERBOSE] [Build] ^
[VERBOSE] [Build] 4 errors generated.

This plugin uses https://github.com/LuisMAlmeida/cordova-plugin-tts (version forked from https://github.com/vilic/cordova-plugin-tts). These versions in the IOS source (src/ios/CDVTTS.m) have a redefinition of variables problem that does not allow to compile in IOS.


  1. You can wait a fix in cordova plugin https://github.com/LuisMAlmeida/cordova-plugin-tts (the version of Vilic Vane is discontinued).
  2. Change the plugin to reference other cordova plugin (for example https://github.com/spasma/cordova-plugin-tts-advanced/) and make little changes in plugin.
  3. Search other speech plugin. :-(
  4. Download https://github.com/LuisMAlmeida/cordova-plugin-tts, make changes in code, generate the .zip and reference it in the plugin (https://success.outsystems.com/Documentation/10/Extensibility_and_Integration/Mobile_Plugins/Using_Cordova_Plugins#Referencing_Cordova_Plugins).

The best option is 1 but perhaps the team of this plugin can give you more information.

Kind regards, David.


Hi David and Abdiel,

As we had Abdiel in on of our Slack channels we touched base with him there and completely forgot to post the answer here too.
We needed this version of the plugin for a project with a strict deadline so we rushed through it a bit, as for this project Android sufficed we focused mainly on that and didn't check iOS.

However now that that project is done we have the time and availability to make some fixes and make it work for Android, iOS and PWA

Just updated the Plugin following your recommendations David, I don't have an iPhone handy yet so I won't be able to properly test it, unfortunately. 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.