Closed eonianvr closed 2 years ago
not sure but seems like wit is sending back unwanted special characters
In WitRequest there is an action called OnRawResponse. Can you add a log statement with the string provided in that callback and check for invalid characters? It would be great if you would attach it here as well.
I figure out you wanted the log on the stringResponse variable?
here it is from a PC. let me know if you want me to provide it from Xcode as well:
stringResponse{"text":"hi","intents":[{"id":"198060945675965","name":"greetings","confidence":0.9371}],"entities":{"subject:subject":[{"id":"265914631568286","name":"subject","role":"subject","start":0,"end":2,"body":"hi","confidence":0.7827,"entities":[],"suggested":true,"value":"hi","type":"value"}]},"traits":{"wit$sentiment":[{"id":"5251aff2-e6f3-4614-81a9-093fb33bdead","value":"positive","confidence":0.7336}],"wit$greetings":[{"id":"5900cc2d-41b7-45b2-b21f-b950d3ae3c5c","value":"true","confidence":0.9999}]}}
Well, it looks like all of the characters in that string are valid. Did you still get the error even with the raw string? Yes, please try to grab the string from xcode as well. The onRawResponse string event happens before it tries to parse the json so we're looking for invalid characters in the json response.
Hey,
what variable host the raw string?
You should have no problem reproducing the bug on your side if you have xcode and an iphone.
As stated before
I previously copied above the error code XCODE gave back while trying to use Response Debugger on iphone.
Thank you
any news?
Sorry about the delayed response, I'm not getting notifications on messages for some reason. I am not setup to develop for IPhone so I can't repro this. Maybe someone else from the team has some IPhone experience, I'll ask around. To get the logs we're after add this somewhere with a reference to your Wit component: wit.events.OnRequestCreated.AddListener((r) => r.onRawResponse += (str) => Debug.Log(str));
You might also try updating Wit to v0.0.10+ there were some bugfixes in there, but I don't think anything specifically related to what you're doing.
Will install the new 0.0.10 version, do a build for iPhone and let you know if the problem is still here . Thanks
Hey Mate. I had a few hours to kill today so I looked at your code and was able to identify the line that create the error mentioned above. it happens in the file WitRequest.cs and is related to the UserAgent.
request.UserAgent = $"wit-unity-{WIT_SDK_VERSION},{operatingSystem},{deviceModel},{deviceName}";
which on my phone generate the string below:
wit-unity-0.0.7,iOS 14.7.1,iPhone12,1,christophe schmitt’s iPhone
I didnt investigate more ( I suspect the ' is responsible) ,
I just replaced it by
request.UserAgent = "wit-unity";
and now the Iphone built is working as expected and the ArgumentException: Specified value has invalid Control characters is gone.
tested on 0.0.7 but should work on 0.0.10 since same problem was still here.
Great find. I got a fix for this pushed and it will go live with v0.0.12 release.
thanks, Happy to help.
I opening this issue using 0.0.7 as I didn't see anyone mentioning it before, so I'm guessing it is still here in the new version.
compiling the response debugger demo with xcode works but when hitting the SEND button ) after entering a sentence (from the Iphone after built is successful and sent to the phone), no answer from wit visible on the screen , and Xcode shows the following error in the console: