iOS Voice input crashes

Source: Internet
Author: User

Any place in the game can be entered, as long as the call voice input, will inevitably cause the app crashes, the workaround is as follows:

OK, so essentially the gist of it was that Siri wants GL context and to be rendered alongside your view. So your need to play nice with it.
First of all in Classes/unity/eaglcontexthelper.h
Add forward declaration for

struct Unitydisplaysurfacebase;

And then inside class Eaglcontextsetcurrentautorestore add constructor:

Eaglcontextsetcurrentautorestore (unitydisplaysurfacebase* surface);

So it's looks like that

struct unitydisplaysurfacebase; <...>classeaglcontextsetcurrentautorestore{public:   Eaglcontext* Old ;   Eaglcontext* cur;    Eaglcontextsetcurrentautorestore (eaglcontext* cur);   Eaglcontextsetcurrentautorestore (unitydisplaysurfacebase* surface);    ~Eaglcontextsetcurrentautorestore ();};

Then in CLASSES/UNITY/EAGLCONTEXTHELPER.MM
Add

" UnityRendering.h "

and implementation for new ctor

Eaglcontextsetcurrentautorestore::eaglcontextsetcurrentautorestore (unitydisplaysurfacebase* surface)  : Old (surface->api = = apimetal?) nil: [Eaglcontext CurrentContext]),   cur (surface->api = = apimetal? Nil: ((unitydisplaysurfacegles*) Surface){   if (old! = cur)     [Eaglcontext setcurrentcontext:cur];}

Afterwards just need to go to classes/unityappcontroller+rendering.mm and add

Eaglcontextsetcurrentautorestore Autorestore (Getmaindisplaysurface ());

To

Static void Unityrepaintimpl (bool forced)

So it looks like this

Static void Unityrepaintimpl (bool  forced) {   @autoreleasepool   {     Eaglcontextsetcurrentautorestore Autorestore (Getmaindisplaysurface ());      Profiler_framestart (); <...>

Again, I cannot even build 4.x now, so are need to use C/OBJC knowledge to fix possible compilation errors (if I forgot to Mention some incudes or smth)

Reference from: http://forum.unity3d.com/threads/dictation-siri-keyboard-crash.358123/

iOS Voice input crashes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.