Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Code works in unity but throws errors in iOS.

$
0
0
I've got this code, which works perfectly fine in Unity Editor on Mac. It's speech recognition (STT) with a plugin from AT&T which apparently is suppose to work with iOS and android. // Use this for initialization void Start () { List scopes = new List(); scopes.Add (RequestFactory.ScopeTypes.Speech); scopes.Add (RequestFactory.ScopeTypes.STTC); scopes.Add (RequestFactory.ScopeTypes.TTS); requestFactory = new RequestFactory(endpoint,apiKey,appSecret,scopes,null,null); } void Awake(){ Environment.SetEnvironmentVariable ("MONO_REFLECTION_SERIALIZER", "yes"); } private bool _recognizing=false; void OnClick(){ if (!_recognizing){ _recognizing=true; StartCoroutine(DoRecognize()); } } private IEnumerator DoRecognize(){ speechText = GameObject.Find ("SpeechLabel").GetComponent (); GetComponent().clip = Microphone.Start (null,false,5,8000); yield return new WaitForSeconds(5); Microphone.End(null); GetComponent().Play(); //hear whatw e got float[] clipData = new float[GetComponent().clip.samples * GetComponent().clip.channels]; GetComponent().clip.GetData(clipData,0); WaveGen.WaveFormatChunk format = new WaveGen().MakeFormat(GetComponent().clip); string filename = Application.persistentDataPath + "/" + "recordedSpeech.wav"; FileStream stream = File.OpenWrite(filename); new WaveGen().Write (clipData,format,stream); stream.Close(); Cert.Instate (); SpeechResponse response = requestFactory.SpeechToText (filename); string transcribedText = response.Recognition.NBest[0].ResultText; speechText.text = transcribedText; _recognizing=false; } } And on iOS and android it doesn't want to work. On android i'm not sure which errors it's throwing up as i'm not sure how to debug that precisely. On iOS I'm getting this error: Validation successful! (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 65) MissingMethodException: Method not found: 'Default constructor not found...ctor() of ATT_MSSDK.OAuthToken+OAuthTokenRaw'. at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToObject (IDictionary`2 dict, System.Type type) [0x00000] in :0 at System.Web.Script.Serialization.JavaScriptSerializer.ConvertToType (System.Type type, System.Object obj) [0x00000] in :0 at ATT_MSSDK.OAuthToken.ParseJSON (System.String jsonInput) [0x00000] in :0 at ATT_MSSDK.RequestFactory.GetNewClientCredential () [0x00000] in :0 at ATT_MSSDK.RequestFactory.GetClientCredentials () [0x00000] in :0 at ATT_MSSDK.RequestFactory.ConvertToText (System.String audioFilePath, System.String speechContext, Nullable`1 xSpeechContext, System.String xArgsParameter, System.Collections.Specialized.NameValueCollection xArgsCollection, ATT_MSSDK.Speechv3.XArgs xArgs) [0x00000] in :0 at ATT_MSSDK.RequestFactory.SpeechToText (System.String audioFilePath) [0x00000] in :0 at VoiceReco+c__Iterator18.MoveNext () [0x00000] in :0 It had a few more errors but i fixed most of them and I am left now only with this one, so it would be nice to get this sorted, anyone please.. ?

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>