Crash while using iOS 7's speech input

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
DanielBocksteger
Developer
Posts: 25
Joined: Tue Jan 21, 2014 9:15 pm
Location: Goch, NRW, Germany
Contact:

Crash while using iOS 7's speech input

Post by DanielBocksteger »

Hi Community,

i'm running into a problem by using Irrlicht on iOS 7 while using the speech (siri) input feature of UITextField. The App crashes directly.

It seems to be the same issue Cocos2d had. http://www.cocos2d-x.org/issues/2920

Is it possible to solve this problem in irrlicht too?

Thanks.
Best regards,
Daniel Bocksteger

German iOS Developer born in '95.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Crash while using iOS 7's speech input

Post by Nadro »

It looks like this problem isn't related to Irrlicht (we don't use UITextField in Irrlicht), but to your code and how you manage UITextField. Check this fix:
https://github.com/boyu0/cocos2d-x/comm ... 577e3120f1
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
DanielBocksteger
Developer
Posts: 25
Joined: Tue Jan 21, 2014 9:15 pm
Location: Goch, NRW, Germany
Contact:

Re: Crash while using iOS 7's speech input

Post by DanielBocksteger »

This fix isn't really adoptable to normal iOS Code. this is a C++/Objective-C mix.

Hoped that anyone here was in struggle with this problem too...
Best regards,
Daniel Bocksteger

German iOS Developer born in '95.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Crash while using iOS 7's speech input

Post by Nadro »

Why not? This is Objective-C++, however important changes are related to Objective-C.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
DanielBocksteger
Developer
Posts: 25
Joined: Tue Jan 21, 2014 9:15 pm
Location: Goch, NRW, Germany
Contact:

Re: Crash while using iOS 7's speech input

Post by DanielBocksteger »

My problem is, that this isn't the normal implementation of UITextField. I can't find the piece of code which has to be adopted to our app.

Tried to get in contact with the developer and waiting for an response now.
Best regards,
Daniel Bocksteger

German iOS Developer born in '95.
DanielBocksteger
Developer
Posts: 25
Joined: Tue Jan 21, 2014 9:15 pm
Location: Goch, NRW, Germany
Contact:

Re: Crash while using iOS 7's speech input

Post by DanielBocksteger »

After some try&error sessions i got a working hack...

Code: Select all

- (void)updateDisplay {
    @try {
        while(isActive)
        {
            @autoreleasepool
            {
                while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, TRUE) == kCFRunLoopRunHandledSource);
            }
            
            if(isActive) {
                
                if (isRunning) {
                    if(!device->run())
                        break;
                    
                    @try {
                        if (device != nil && driver->endScene()){// && driver->beginScene()) {
                            [self beginScene];
                            
                            // Wird auf dem Main-Thread ausgeführt, da es sonst zu Komplikationen zwischen den Threads kommt.
                            [self performSelectorOnMainThread:@selector(drawAll) withObject:nil waitUntilDone:YES];
                            
                            // Wird ausgeführt wenn drawAll() durch gelaufen ist !!!   ------------------------^
                            [self performSelectorOnMainThread:@selector(endScene) withObject:nil waitUntilDone:YES];
                            
                            //device->yield();
                        }
                        else{
                            driver->endScene();
                        }
                    }
                    @catch (NSException *exception) {
                        SPAlertView *alert = [WWSExceptionManager showException:exception.description andLocation:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__]];
                        [alert show];
                    }
                }
            }
            else
            {
                driver->endScene();
                //device->drop();
            }
        }
    }
    @catch (NSException *exception) {
        SPAlertView *alert = [WWSExceptionManager showException:exception.description andLocation:[NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__]];
        [alert show];
    }
}
Now the App isn't crashing when users starts the voice recognition. I set the isRunnung property to NO while user-input and YES when the user finished.

Problem:
After finishing the editing-mode the irrlicht scene is completly "blue"...

Image
Best regards,
Daniel Bocksteger

German iOS Developer born in '95.
DanielBocksteger
Developer
Posts: 25
Joined: Tue Jan 21, 2014 9:15 pm
Location: Goch, NRW, Germany
Contact:

Re: Crash while using iOS 7's speech input

Post by DanielBocksteger »

Is it Possible to pause the Irrlicht-Device and the render loop without pausing the complete App/iPad?

When we use yield() or sleep() the hole iPad sleeps.

Thanks.
Best regards,
Daniel Bocksteger

German iOS Developer born in '95.
Post Reply